Skip to content

Commit a1e63e7

Browse files
avara1986claude
andauthored
ci(benchmarks): repair telemetry_dependencies baseline import (#17595)
## 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>
1 parent 982e953 commit a1e63e7

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

benchmarks/telemetry_dependencies/scenario.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,10 @@ def _run_old_api(self, loops):
209209
210210
Only supports first/idle phases since CVE/SCA features don't exist.
211211
"""
212-
from ddtrace.internal.telemetry.dependency import DependencyEntry as DE
213-
214212
n = self.num_deps
215213
phase = self.phase
216214

217215
if phase == "first":
218-
# Simulate discovering N new modules
219216
module_names = ["mod-%d" % i for i in range(n)]
220217

221218
def fake_get_dist(module_name):
@@ -235,11 +232,9 @@ def fake_get_dist(module_name):
235232
return total
236233
else:
237234
# idle / cve_registration / sca_hits all reduce to "nothing to do"
238-
# on main since there's no re-report logic
239-
already_imported = {}
240-
for i in range(n):
241-
name = "package-%d" % i
242-
already_imported[name] = DE(name=name, version="%d.0.0" % i, metadata=None)
235+
# on main since there's no re-report logic. On the old API,
236+
# `already_imported` maps name -> version string.
237+
already_imported = {"package-%d" % i: "%d.0.0" % i for i in range(n)}
243238

244239
def fake_get_dist(module_name):
245240
return None

0 commit comments

Comments
 (0)