Skip to content

ci(benchmarks): repair telemetry_dependencies baseline import#17595

Merged
juanjux merged 2 commits intomainfrom
fix/telemetry-dependencies-benchmark-baseline
Apr 17, 2026
Merged

ci(benchmarks): repair telemetry_dependencies baseline import#17595
juanjux merged 2 commits intomainfrom
fix/telemetry-dependencies-benchmark-baseline

Conversation

@avara1986
Copy link
Copy Markdown
Member

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

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>
@avara1986 avara1986 added the changelog/no-changelog A changelog entry is not required for this PR. label Apr 17, 2026
@cit-pr-commenter-54b7da
Copy link
Copy Markdown

Codeowners resolved as

benchmarks/telemetry_dependencies/scenario.py                           @DataDog/apm-core-python

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Apr 17, 2026

Benchmarks

Benchmark execution time: 2026-04-17 12:19:15

Comparing candidate commit 99d8918 in PR branch fix/telemetry-dependencies-benchmark-baseline with baseline commit 982e953 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 4 metrics, 0 unstable metrics.

@avara1986 avara1986 changed the title fix(benchmarks): repair telemetry_dependencies baseline import ci(benchmarks): repair telemetry_dependencies baseline import Apr 17, 2026
@avara1986
Copy link
Copy Markdown
Member Author

/merge -f

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Apr 17, 2026

View all feedbacks in Devflow UI.

2026-04-17 12:49:29 UTC ℹ️ Start processing command /merge -f


2026-04-17 12:49:31 UTC ❌ MergeQueue

You need to provide a reason for skipping checks

@avara1986
Copy link
Copy Markdown
Member Author

/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"

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Apr 17, 2026

View all feedbacks in Devflow UI.

2026-04-17 12:51:14 UTC ℹ️ Start processing command /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"


2026-04-17 12:51:18 UTC ❌ MergeQueue

This PR is a draft

@avara1986 avara1986 marked this pull request as ready for review April 17, 2026 12:51
@avara1986 avara1986 requested a review from a team as a code owner April 17, 2026 12:51
@avara1986 avara1986 requested a review from juanjux April 17, 2026 12:51
@avara1986
Copy link
Copy Markdown
Member Author

/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"

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Apr 17, 2026

View all feedbacks in Devflow UI.

2026-04-17 12:51:38 UTC ℹ️ Start processing command /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"


2026-04-17 12:51:48 UTC ℹ️ MergeQueue: waiting for PR to be ready

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.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-04-17 12:58:52 UTC ⚠️ MergeQueue: This merge request was unqueued

alberto.vara@datadoghq.com unqueued this merge request

@juanjux juanjux merged commit a1e63e7 into main Apr 17, 2026
279 of 282 checks passed
@juanjux juanjux deleted the fix/telemetry-dependencies-benchmark-baseline branch April 17, 2026 13:15
dubloom pushed a commit that referenced this pull request Apr 21, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants