Skip to content

python: assert the theoretical wall-samples rate in python_sample_count - #228

Merged
taegyunkim merged 2 commits into
mainfrom
taegyun.kim/python-sample-count-ddtrace-4.16
Oct 28, 2026
Merged

taegyunkim merged 2 commits into
mainfrom
taegyun.kim/python-sample-count-ddtrace-4.16

Conversation

@taegyunkim

@taegyunkim taegyunkim commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Changes the expected wall-samples rate in python_sample_count_3.12 from 4000 ± 20% to 5000 ± 30% samples per second. The accepted range moves from 3200–4800/s to 3500–6500/s.

5000/s is the theoretical rate: the sampler runs 100 times per second (g_default_sampling_period_us = 10000), and each pass samples at most 50 tasks (default max_tasks). The scenario now asserts that rate instead of a value picked from past runs.

Motivation

The profiler now takes about 4700–4900 samples per second in this scenario. That is often above the old 4800/s limit, so the scenario fails about 22–23% over target:

Assertion failed: profile 'wall-samples' should have total matching sum of 8552 +/- 20% but was 10526 with 23.1% error

It started failing in the nightly on 2026-10-17, the day after ddtrace 4.16.0 reached PyPI, and failed on 9 of the next 11 nightlies. It still fails now that the nightly installs dd-trace-py main (#227): 2 of the 3 runs since #227 merged failed.

Measured rates (samples ÷ profile duration):

ddtrace build Runs Samples/s Passes old 3200–4800? Passes new 3500–6500?
4.15.x (PyPI) nightlies 09-27 to 10-16 3890–4775 yes, but up to 19% over yes
4.16.0 (PyPI) nightlies 10-17 to 10-27 4624–4931 mostly no yes
dd-trace-py main #227 CI and runs since it merged 3667–4919 2 of 7 failed yes

Real runs stay below 5000/s, for example when the sampler thread wakes late on a busy host. The slowest runs reach about 3670/s, so the margin is 30%: ±20% around 5000 would set the floor at 4000/s and fail those runs. The cap of 6500/s is above what the sampler can produce, so it still catches over-counting of more than 30%.

Validation

  • CI on this PR passes the scenario on a dd-trace-py main build (run 40710242609 with the earlier 4500/s target measured 4489/s, inside the new range).
  • go test -run TestSchemaValidation passes.

@datadog-official

datadog-official Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Pipelines

✨ Unblock PR with BitsAI

⚠️ Warnings

Your PR has warnings. Please review the issues below.

🚦 1 Pipeline job failed

prof-correctness | python / scenarios 1/13 — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b97e1cf | Docs | View more details | Give us feedback!

@taegyunkim
taegyunkim force-pushed the taegyun.kim/python-sample-count-ddtrace-4.16 branch from 5ba8a9c to 5504f14 Compare October 28, 2026 14:52
@taegyunkim
taegyunkim marked this pull request as ready for review October 28, 2026 15:48
@taegyunkim
taegyunkim requested a review from a team as a code owner October 28, 2026 15:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T15:50:02.114391Z 5504f14 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@taegyunkim taegyunkim changed the title python: recalibrate python_sample_count wall-samples rate for ddtrace 4.16 python: assert the theoretical wall-samples rate in python_sample_count Oct 28, 2026
@taegyunkim
taegyunkim merged commit e6e2b9f into main Oct 28, 2026
82 of 83 checks passed
@taegyunkim
taegyunkim deleted the taegyun.kim/python-sample-count-ddtrace-4.16 branch October 28, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants