ci(benchmarks): repair telemetry_dependencies baseline import#17595
ci(benchmarks): repair telemetry_dependencies baseline import#17595
Conversation
The _run_old_api path unconditionally imported DependencyEntry from
ddtrace.internal.telemetry.dependency at function scope, but that
module does not exist on the baseline (pre-SCA-reachability). Python
evaluates function-scope imports on call, so the baseline wheel
crashed with ModuleNotFoundError before reaching any phase branch.
Remove the broken import and rewrite the idle/fallback branch to
populate already_imported as {name: version_str}, matching the
baseline update_imported_dependencies(Dict[str, str], ...) contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codeowners resolved as |
BenchmarksBenchmark execution time: 2026-04-17 12:19:15 Comparing candidate commit 99d8918 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 4 metrics, 0 unstable metrics. |
|
/merge -f |
|
View all feedbacks in Devflow UI.
You need to provide a reason for skipping checks |
|
/merge -f --reason "microbenchmark test is failing on main, this PR fix the problem but because of the failure on main, it can’t be merged" |
|
View all feedbacks in Devflow UI.
This PR is a draft |
|
/merge -f --reason "microbenchmark test is failing on main, this PR fix the problem but because of the failure on main, it can’t be merged" |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
alberto.vara@datadoghq.com unqueued this merge request |
## Summary The `telemetry_dependencies` benchmark was failing against the baseline wheel after #17156 merged, with: ``` ModuleNotFoundError: No module named 'ddtrace.internal.telemetry.dependency' ``` Root cause: `scenario._run_old_api` had a function-scope `from ddtrace.internal.telemetry.dependency import DependencyEntry as DE` that Python evaluates on every call. The baseline wheel predates the SCA-reachability PR, so that module does not exist and the import crashes before any phase branching. The `else` branch also populated `already_imported` with `DependencyEntry` instances, but the baseline's `update_imported_dependencies(already_imported: Dict[str, str], ...)` expects version strings — it would break if ever exercised. ## Changes - Drop the broken top-level import. - Rewrite the idle/fallback branch to populate `already_imported` as `{name: version_str}`, matching the baseline contract. The candidate (new-API) path is unaffected — it runs `_run_new_api` because `HAS_DEPENDENCY_TRACKER` is True on current `main`. ## Test plan - [ ] Re-run the benchmark platform job for `telemetry_dependencies` and confirm it completes for both baseline and candidate. - [ ] Spot-check that the `telemetry_add_metric` job (which was already passing) is still unaffected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
The
telemetry_dependenciesbenchmark was failing against the baselinewheel after #17156 merged, with:
Root cause:
scenario._run_old_apihad a function-scopefrom ddtrace.internal.telemetry.dependency import DependencyEntry as DEthat Python evaluates on every call. The baseline wheel predates the
SCA-reachability PR, so that module does not exist and the import
crashes before any phase branching. The
elsebranch also populatedalready_importedwithDependencyEntryinstances, but the baseline'supdate_imported_dependencies(already_imported: Dict[str, str], ...)expects version strings — it would break if ever exercised.
Changes
already_importedas
{name: version_str}, matching the baseline contract.The candidate (new-API) path is unaffected — it runs
_run_new_apibecauseHAS_DEPENDENCY_TRACKERis True on currentmain.Test plan
telemetry_dependenciesand confirm it completes for both baseline and candidate.
telemetry_add_metricjob (which wasalready passing) is still unaffected.
🤖 Generated with Claude Code