Skip to content

fix(crastracking): strip bootstrap dir for ct receiver - #20084

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits into
mainfrom
gyuheon0h/bootstrap-ct-receiver
Sep 8, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits into
mainfrom
gyuheon0h/bootstrap-ct-receiver

Conversation

@gyuheon0h

@gyuheon0h gyuheon0h commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

PROF-15922

Description

The crashtracker receiver subprocess inherits PYTHONPATH from the parent process. When the parent was launched with ddtrace-run, that PYTHONPATH includes the bootstrap dir containing sitecustomize.py, so the receiver's own interpreter re-runs the full ddtrace bootstrap, starting a second, independently-configured copy of ddtrace using the receiver's stripped-down env (no DD_ENV/DD_SERVICE). This was noticed here in this schema check failure for system tests

We can strip the ddtrace-run bootstrap directory out of the inherited PYTHONPATH before spawning the receiver, so it stays an uninstrumented script while still able to locate the ddtrace package using any other PYTHONPATH entries.

Testing

Risks

Additional Notes

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@gyuheon0h gyuheon0h changed the title Strip bootstrap dir for ct receiver fix(crastracking): strip bootstrap dir for ct receiver Sep 4, 2026
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

No remaining files require a CODEOWNERS review.

@datadog-official

datadog-official Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 2 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector
ddtrace.appsec._asm_request_context -> ddtrace.appsec._iast._iast_request_context_base -> ddtrace.appsec._iast._iast_env -> ddtrace.appsec._iast.reporter -> ddtrace.appsec._exploit_prevention.stack_traces -> ddtrace.appsec._asm_request_context

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 230 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 230 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=134)
ddtrace.internal.opentelemetry.trace -×-> ddtrace.trace  (product:opentelemetry -> product:tracing, score=132)
ddtrace.debugging._signal.model -×-> ddtrace.trace  (product:debugging -> product:tracing, score=132)
ddtrace.llmobs._telemetry -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=132)
ddtrace.profiling.scheduler -×-> ddtrace.trace  (product:profiling -> product:tracing, score=132)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@gyuheon0h gyuheon0h added the changelog/no-changelog A changelog entry is not required for this PR. label Sep 4, 2026
@gyuheon0h
gyuheon0h marked this pull request as ready for review September 4, 2026 17:51
@gyuheon0h
gyuheon0h requested review from a team as code owners September 4, 2026 17:51
@gyuheon0h gyuheon0h changed the title fix(crastracking): strip bootstrap dir for ct receiver chore(crastracking): strip bootstrap dir for ct receiver Sep 4, 2026
@gyuheon0h gyuheon0h changed the title chore(crastracking): strip bootstrap dir for ct receiver fix(crastracking): strip bootstrap dir for ct receiver Sep 4, 2026
@gyuheon0h
gyuheon0h requested a review from a team as a code owner September 4, 2026 17:55

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f554c4281

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ddtrace/internal/core/crashtracking.py Outdated
Comment thread tests/crashtracker/test_crashtracker.py
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/bootstrap-ct-receiver branch 2 times, most recently from c380eaf to dd4a177 Compare September 4, 2026 18:01
@gyuheon0h gyuheon0h removed the changelog/no-changelog A changelog entry is not required for this PR. label Sep 4, 2026
@pr-commenter

pr-commenter Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-09-08 17:30:22

Comparing candidate commit 62ca6ac in PR branch gyuheon0h/bootstrap-ct-receiver with baseline commit 3f36032 in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 568 metrics, 10 unstable metrics, 6 known flaky benchmarks, 18 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:samplingrules-high_match

  • 🟥 execution_time [+13.958µs; +16.353µs] or [+8.990%; +10.533%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-708.759ns; +766.442ns] or [-6.416%; +6.938%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-31.747ns; +34.126ns] or [-5.193%; +5.582%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1677.731ns; +1608.653ns] or [-9.844%; +9.439%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1408.945ns; +1030.082ns] or [-10.666%; +7.798%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-326.824ns; +321.249ns] or [-8.907%; +8.755%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-246.406ns; +252.076ns] or [-8.417%; +8.611%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-56.237ns; +92.515ns] or [-4.957%; +8.155%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3782.253ns; +4217.573ns] or [-9.253%; +10.318%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-697.053ns; +882.704ns] or [-8.643%; +10.945%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-52.725µs; +58.387µs] or [-9.082%; +10.057%]

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+1.820µs; +2.036µs] or [+10.537%; +11.784%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+129.300µs; +136.749µs] or [+33.020%; +34.923%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+16.415µs; +19.653µs] or [+11.435%; +13.691%]

scenario:span-start

  • 🟥 execution_time [+1.609ms; +1.755ms] or [+11.389%; +12.424%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+339.658ns; +386.338ns] or [+11.768%; +13.385%]

scenario:tracer-small

  • 🟥 execution_time [+39.050µs; +41.183µs] or [+12.021%; +12.678%]

Known flaky benchmarks without significant changes:

  • scenario:errortrackingflasksqli-baseline
  • scenario:flasksimple-iast-get
  • scenario:iastaspects-casefold_aspect
  • scenario:iastaspects-casefold_noaspect
  • scenario:iastaspects-index_aspect
  • scenario:iastaspects-ljust_noaspect
  • scenario:iastaspects-lower_aspect
  • scenario:iastaspects-replace_aspect
  • scenario:iastaspects-rstrip_aspect
  • scenario:iastaspects-swapcase_aspect
  • scenario:iastaspects-title_noaspect
  • scenario:iastaspects-translate_aspect
  • scenario:iastaspects-translate_noaspect
  • scenario:iastaspects-upper_noaspect
  • scenario:packagespackageforrootmodulemapping-cache_off
  • scenario:packagespackageforrootmodulemapping-cache_on
  • scenario:sethttpmeta-all-enabled
  • scenario:telemetryaddmetric-record-100-metrics

Comment thread ddtrace/internal/core/crashtracking.py Outdated
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/bootstrap-ct-receiver branch from 2e9ac21 to 4ddc4d6 Compare September 8, 2026 13:15

@brettlangdon brettlangdon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit, otherwise lgtm

question: worth injecting an env var when the receiver is running, and we can have our bootstrap exit early or something when in that case?

Comment thread releasenotes/notes/crashtracker-receiver-bootstrap-strip-832d20b15c4229aa.yaml Outdated

@taegyunkim taegyunkim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlaps with my earlier PR, #19735.

My main request is to bring over the subprocess regression so we verify both native-module importability and the absence of receiver self-instrumentation, rather than only checking the generated PYTHONPATH

Comment thread ddtrace/internal/core/crashtracking.py Outdated
Comment thread tests/crashtracker/test_crashtracker.py
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/bootstrap-ct-receiver branch from 13969bb to de219b4 Compare September 8, 2026 14:39
@gyuheon0h
gyuheon0h requested a review from taegyunkim September 8, 2026 14:44
Comment thread ddtrace/internal/core/crashtracking.py
@gyuheon0h
gyuheon0h requested a review from taegyunkim September 8, 2026 15:44
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/bootstrap-ct-receiver branch from 7bd7d05 to 62ca6ac Compare September 8, 2026 16:52
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 56dcf88 into main Sep 8, 2026
1425 of 1426 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the gyuheon0h/bootstrap-ct-receiver branch September 8, 2026 23:00
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.

3 participants