Skip to content

ci(native): check that libdatadog uses one release tag - #21843

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
dd/ci/check-libdatadog-release-pin-7c88
Nov 18, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
dd/ci/check-libdatadog-release-pin-7c88

Conversation

@brettlangdon

Copy link
Copy Markdown
Member

Description

The libdatadog project releases all its crates together. dd-trace-py must thus depend on libdatadog through exactly one release tag. A commit SHA, a branch, the default branch or a mix of releases can ship unreleased native code or put two copies of libdatadog into the native extension. Reviewers check this by hand at this time.

This PR adds a CI check for this rule. It replaces the approach in #21692 (Bash and regular expressions) with a small Python script that uses the tomllib TOML parser. There is no opt-out marker.

scripts/check_libdatadog_pins.py finds all tracked Cargo.toml and Cargo.lock files with git ls-files, and makes sure that:

  • Each libdatadog git dependency in a Cargo.toml sets rev or tag to a vX.Y.Z release tag. The script examines all tables, which includes [dependencies], [dev-dependencies], [build-dependencies], [target.*.dependencies], [workspace.dependencies] and [patch.*].
  • Each libdatadog [[package]].source in a Cargo.lock uses rev= or tag= with a vX.Y.Z release tag.
  • All Cargo.lock files together have exactly one libdatadog source. This includes the commit hash, thus two lockfiles that resolve the same tag to different commits also fail.
  • The release tag in the Cargo.toml files is the same as the release tag in the Cargo.lock files.

Other changes:

  • .gitlab/native.yml: new libdatadog pins job. It extends .ci_utils (small image with Python 3.14) and runs python3 scripts/check_libdatadog_pins.py.
  • scripts/run-script-doctests.py: runs the doctests of the new script. The requires-python value changes from >=3.9 to >=3.11 because the script uses tomllib.

The script uses a TOML parser, thus these edge cases from the #21692 review are not a problem:

  • Table-form dependencies ([dependencies.libdd-common] with git and rev on different lines) are accepted.
  • Single-quoted TOML strings are read correctly.
  • A release tag in a comment (rev = "deadbeef" # rev = "v49.0.0") does not hide a SHA pin.
  • tag = "vX.Y.Z" is accepted, and rev = "vX.Y.Z" is also accepted.
  • There is no opt-out marker, thus an opted-out pin cannot skip the tag comparison.
  • The script does not use GNU-only tools such as sort -V.
  • The error output is plain text, not GitHub Actions annotations, because the job runs in GitLab.

Testing

  • python3 scripts/check_libdatadog_pins.py on this branch passes: OK: libdatadog source is git+https://github.com/DataDog/libdatadog?rev=v49.0.0#34293ad2....
  • Doctests in the script cover URL matching (.git suffix, trailing slash, case, ssh://, other repositories), table-form dependencies, single quotes, inline comments, branch, the default branch, [target.*] and [patch.*] tables, and Cargo.lock rev=/tag=/branch=/no query. They run in the Run scripts/*.py tests precheck.
  • Manual checks in a temporary git repository with copies of the real Cargo files. Each of these fails: SHA pin in Cargo.toml and Cargo.lock, mixed v48.0.0/v49.0.0 tags, stale Cargo.lock (Cargo.toml at v50.0.0, lock at v49.0.0), branch and default branch, a second lockfile with a different libdatadog source, a SHA hidden by a comment, a [patch] entry on a branch, and no libdatadog source. Table-form, single-quoted, commented and tag = dependencies (with a ?tag= lock source) pass.
  • scripts/lint checks passes.
  • The GitLab job itself did not run locally.

Risks

  • A PR that needs an unreleased libdatadog commit for a short time fails this job until libdatadog makes a release. This is intended.
  • The job fails if no libdatadog git source is found. If dd-trace-py stops using libdatadog through git (for example, it moves to crates.io), update or remove this check.
  • crates.io dependencies on libdatadog crates (for example libdd-profiling-heap-gotter in src/native_heap_gotter) are not checked. They do not use a git tag.
  • scripts/run-script-doctests.py now needs Python 3.11 or later.

Additional Notes

🤖 Generated with Claude Code (https://claude.com/claude-code)


PR by Bits - View session in Datadog • Open in Slack

Comment @DataDog to request changes

Add scripts/check_libdatadog_pins.py. The script reads all tracked
Cargo.toml and Cargo.lock files with tomllib. It makes sure that each
libdatadog git dependency and each Cargo.lock source uses a "vX.Y.Z"
release tag, that the Cargo.lock files have exactly one libdatadog
source, and that the Cargo.toml and Cargo.lock tags are the same.

Add the "libdatadog pins" GitLab job to run the script. Add the script
to the script doctests, and set the doctest runner to Python 3.11 or
later because the script uses tomllib.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: brettlangdon <me@brett.is>
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

View session in Datadog

Bits Code status: ✅ Done

Comment @DataDog to request changes

@datadog-official datadog-official Bot added Bits AI changelog/no-changelog A changelog entry is not required for this PR. labels Nov 17, 2026
@brettlangdon
brettlangdon marked this pull request as ready for review November 17, 2026 13:59
@brettlangdon
brettlangdon requested a review from a team November 17, 2026 13:59
@brettlangdon
brettlangdon requested review from a team as code owners November 17, 2026 13:59
@brettlangdon
brettlangdon requested review from Yun-Kim, juanjux and vlad-scherbich and removed request for a team November 17, 2026 13:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T16:54:27.717474Z 2246393 New commits
🔒 Security Review ✅ Completed 2026-11-17T16:57:10.914805Z 2246393 New commits
ℹ️ 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.

@cit-pr-commenter-54b7da

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.

.gitlab/native.yml                                                      @DataDog/python-guild @DataDog/apm-core-python @DataDog/profiling-python
scripts/check_libdatadog_pins.py                                        @DataDog/python-guild
scripts/run-script-doctests.py                                          @DataDog/python-guild

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 66 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=120)
ddtrace.llmobs._integrations.anthropic -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.vertexai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.openai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)
ddtrace.llmobs._integrations.mcp -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=118)

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

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot 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.

Bits Code Review: PASS

More details

The checker accepts the repository’s current release pin and correctly handles the valid and invalid pin scenarios exercised by the specialist. Execution of the GitLab job remains unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 7c88484

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

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

@pr-commenter

pr-commenter Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-17 17:14:55

Comparing candidate commit 2246393 in PR branch dd/ci/check-libdatadog-release-pin-7c88 with baseline commit 94ae319 in branch main.

📊 Benchmarking dashboard

Found 4 performance improvements and 0 performance regressions! Performance is the same for 634 metrics, 10 unstable metrics, 1 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:httppropagationextract-empty_headers

  • 🟩 execution_time [-72.837ns; -57.861ns] or [-9.571%; -7.603%]

scenario:httppropagationextract-wsgi_empty_headers

  • 🟩 execution_time [-73.566ns; -59.717ns] or [-9.663%; -7.844%]

scenario:httppropagationextract-wsgi_invalid_span_id_header

  • 🟩 execution_time [-81.094ns; -62.804ns] or [-10.551%; -8.171%]

scenario:rand-rand64bits

  • 🟩 execution_time [-15.816ns; -11.140ns] or [-12.800%; -9.015%]

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 [-682.000ns; +709.959ns] or [-6.353%; +6.614%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-28.874ns; +38.180ns] or [-4.425%; +5.851%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1792.165ns; +1852.255ns] or [-8.896%; +9.194%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1970.942ns; +1508.834ns] or [-10.229%; +7.831%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-365.334ns; +354.372ns] or [-8.466%; +8.212%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-216.395ns; +221.176ns] or [-8.002%; +8.178%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-112.324ns; +51.878ns] or [-8.086%; +3.735%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-4865.028ns; +4014.512ns] or [-9.913%; +8.180%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-1050.383ns; +806.556ns] or [-10.010%; +7.687%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-57.670µs; +54.208µs] or [-9.801%; +9.213%]

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.

Known flaky benchmarks without significant changes:

  • scenario:packagespackageforrootmodulemapping-cache_off

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 6e3d5c4 into main Nov 18, 2026
886 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the dd/ci/check-libdatadog-release-pin-7c88 branch November 18, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bits AI 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