Skip to content

chore(deps): update libdatadog to 72fa8685 and serverless-components to 9daae40 - #1332

Merged
lucaspimentel merged 6 commits into
mainfrom
lpimentel/bump-libdatadog-72fa8685
Aug 28, 2026
Merged

chore(deps): update libdatadog to 72fa8685 and serverless-components to 9daae40#1332
lucaspimentel merged 6 commits into
mainfrom
lpimentel/bump-libdatadog-72fa8685

Conversation

@lucaspimentel

@lucaspimentel lucaspimentel commented Aug 19, 2026

Copy link
Copy Markdown
Member

Stacked PRs:

Overview

Tactical dependency bump, behavior-preserving: every changed call site is adapted to the
new APIs without altering runtime behavior. In particular the new
override_cardinality_limits parameter is pinned to reproduce bottlecap's pre-bump
aggregation exactly (see commit 2); adopting libdatadog's default cardinality limits is a
customer-visible change and is deferred to the follow-up PR. Two queued features are blocked
behind the same dependency move:

This PR does only the bump; both features become pure wiring afterwards.

Pin From To
libdatadog (7 direct deps) 85ce322a 72fa8685
serverless-components (3 deps) d0c7f44 9daae40
dd-trace-rs 50bfea87 unchanged
[patch.crates-io] (16 entries) present deleted

Both rev bumps must land together: SCL d0c7f44's datadog-agent-config pinned libdatadog
85ce322a, so bumping only one side leaves two ReplaceRule types structurally identical
but resolved as distinct crate instances, which rustc rejects with E0308.

[patch.crates-io] is deleted rather than repointed: rev 72fa8685 carries an unreleased
breaking libdd-telemetry change under an unchanged crate version (libdatadog #2172), so
patching datadog-opentelemetry v0.5.0's transitive libdd-telemetry against it fails
E0107/E0433. Letting the tracer resolve libdd-* from crates.io — the arrangement
serverless-components already uses — avoids that, at the cost of 11 duplicated libdd-*
crates in the dependency graph. As a side effect, bottlecap's own libdd-trace-stats no
longer enables stats-obfuscation (that feature arrived only via the now-deleted patch's
crate-id unification), so SpanConcentrator::new drops its obfuscation argument entirely
(arity 6, not 7) rather than gaining a new parameter.

dd-trace-rs is intentionally not bumped: v0.5.1 raises libdd-sampling to 6.0.0, which
72fa8685 does not carry. That belongs to a future crates.io migration.

Commits

  1. refactor(traces): pass tracer header tags to the App & API Protection hold path as one
    struct
    — pure no-op cleanup on the old rev. HoldArguments flattened all 10
    TracerHeaderTags fields with a tracer_header_tags_ prefix; collapses them into the
    OwnedTracerHeaderTags struct that already exists for this purpose. Makes the bump
    commit's appsec diff zero.
  2. chore(deps): update libdatadog to 72fa8685 and serverless-components to 9daae40 — the
    bump itself:
    • TracerHeaderTags split (libdatadog #2279): client_computed_stats,
      client_computed_top_level, dropped_p0_traces, dropped_p0_spans moved into a nested
      TracerGenericTags. Mechanical follow-through at every construction site and the field
      reads that touched them directly.
    • SpanConcentrator::new signature: 5th param changed from
      override_max_entries_per_bucket: Option<usize> to
      override_cardinality_limits: Option<CardinalityLimitConfig>, plus a new 6th
      additional_metric_tag_keys: Vec<String> param. All five limits are pinned to
      effectively-unbounded values so bottlecap's pre-existing unbounded aggregation is
      preserved bit-for-bit; passing None would silently opt into
      CardinalityLimitConfig::default(). Per-field limits are usize::MAX - 1 rather than
      usize::MAX only because the constructor warns when whole_key_limit is not strictly
      greater than every per-field limit; both values are unreachable.
      additional_metric_tag_keys is Vec::new() — no change to the aggregation dimensions.
    • [patch.crates-io] removed (see above).
  3. refactor(traces): simplify App & API Protection held-trace sender — build the
    held-trace sender by spreading the existing processor rather than copying each field, so
    it does not silently need updating when SendingTraceProcessor gains one. Also documents
    in Cargo.toml why the libdd-* crates are no longer deduplicated, and how to re-check
    (cargo tree --duplicates | grep ^libdd-) when bumping either side. Repointing the patch
    at only the non-libdd-telemetry crates was tested and does not dedupe: this rev's
    libdd-common is 5.1.0 while published libdd-data-pipeline 7.0.0 requires ^5.2.0, so
    the patch simply goes unused for the registry consumers.

Size impact (amd64)

Built via ARCHITECTURE=amd64 FIPS=false ./scripts/build_bottlecap_layer.sh on main
(fbf128dc) and on this branch.

Baseline (85ce322a) Post-bump (72fa8685) Delta
Layer zip 4,716,191 B 4,734,152 B +17,961 B (+0.38%)
Unpacked binary 11,526,720 B 11,571,776 B +45,056 B (+0.39%)
libdd-* duplicates (cargo tree --duplicates) 0 11 +11

Both figures land far under the GitLab CI caps for amd64 (27 MB compressed / 54 MB
uncompressed). The release profile (opt-level = "z", LTO, codegen-units = 1,
strip = true) absorbs nearly all of the size cost of the 11 newly-duplicated libdd-*
crates.

Downstream handoff (not part of this PR)

  • lpimentel/add-trace-error-sampler ([APMSVLS-469] feat(traces): add error sampler to keep/rescue traces with errors #1320): rebase onto main, repin its four
    serverless-components deps 54e570ae9daae40. Conflicts will concentrate in
    Cargo.toml/Cargo.lock plus any TracerHeaderTags literals its commits added.
  • Follow-up PR (APMSVLS-485, to be opened off this branch): adopt libdatadog's default
    cardinality limits — 7000 whole-key, 1024 resource, 512 http endpoint, 512 peer tags, 100
    additional tags — plus reporting when keys collapse. That is where the customer-visible
    change lives, so it is reviewed on its own rather than buried in a chore(deps) PR.
  • lpimentel/span-derived-primary-tags ([APMSVLS-485] feat(traces): span-derived primary tags #1336): rebases onto that follow-up PR.

Testing

  • cargo check --workspace --all-targets — clean, no warnings
  • cargo fmt --all -- --check — clean
  • cargo clippy --workspace --all-targets --features default -- -D warnings — clean
  • cargo clippy --workspace --all-targets --no-default-features --features fips -- -D warnings
    — clean (highest-risk check: patch-block deletion changes TLS feature flow)
  • cargo nextest run --workspace — clean
  • cargo nextest run --workspace -E 'test(cardinality)'
    test_no_cardinality_limit_applied feeds 7,001 distinct resources (exceeding both the
    default whole_key_limit of 7,000 and resource_limit of 1,024) and asserts that no
    key collapses into tracer_blocked_value, so a regression back to None fails it twice
    over; passes
  • cargo audit — 1 pre-existing vulnerability (h2 0.4.13, RUSTSEC-2026-0258), unchanged by
    this PR and present on main before this branch; 9 unmaintained/unsound warnings, all
    non-blocking in CI's rustsec/audit-check job
  • dd-rust-license-tool check — already up to date, no LICENSE-3rdparty.csv changes needed
    (crate name-keyed, so the git/crates.io copies of each libdd-* crate collapse to one row)
  • ./scripts/verify_tls_root_features.sh — OK, reqwest root sources correct for both default
    and FIPS builds

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 19, 2026

Copy link
Copy Markdown

Tests

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

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

@lucaspimentel
lucaspimentel marked this pull request as ready for review August 19, 2026 18:58
@lucaspimentel
lucaspimentel requested a review from a team as a code owner August 19, 2026 18:58
Copilot AI lite review requested due to automatic review settings August 19, 2026 18:58
@lucaspimentel
lucaspimentel requested a review from a team as a code owner August 19, 2026 18:58

Copilot AI 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.

Pull request overview

Updates Bottlecap’s pinned libdatadog and serverless-components revisions in lockstep to unblock upcoming trace features, and adjusts internal code to match upstream API changes (notably TracerHeaderTags restructuring and SpanConcentrator::new signature/cardinality behavior).

Changes:

  • Bump libdatadog rev to 72fa8685 and serverless-components rev to 9daae40, with corresponding Cargo.lock resolution changes (including intentional libdd-* duplication).
  • Update trace header tag plumbing to use TracerGenericTags and carry header tags across async boundaries via OwnedTracerHeaderTags.
  • Update stats concentrator initialization to explicitly preserve “unbounded” cardinality behavior via CardinalityLimitConfig, and adapt tests accordingly.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bottlecap/tests/apm_integration_test.rs Adjusts test header tag construction to the new TracerHeaderTags { generic: ... } shape.
bottlecap/src/traces/trace_processor.rs Updates header-tag reads and uses OwnedTracerHeaderTags when holding traces for AppSec.
bottlecap/src/traces/trace_aggregator.rs Refactors OwnedTracerHeaderTags to store the new generic tag struct and reconstruct TracerHeaderTags.
bottlecap/src/traces/trace_aggregator_service.rs Updates tests to construct header tags with nested generic fields.
bottlecap/src/traces/trace_agent.rs Switches computations to read stats/top-level flags from tags.generic.*.
bottlecap/src/traces/stats_concentrator_service.rs Adapts SpanConcentrator::new call to new cardinality config + additional tag keys, and updates the no-cardinality-limit test.
bottlecap/src/otlp/agent.rs Reads client_computed_stats from tracer_header_tags.generic.
bottlecap/src/lifecycle/invocation/processor.rs Updates test tag construction to the new generic nesting.
bottlecap/src/appsec/processor/context.rs Stores held trace header tags as OwnedTracerHeaderTags and converts back via to_tracer_header_tags().
bottlecap/Cargo.toml Bumps libdatadog + serverless-components git rev pins and removes [patch.crates-io].
bottlecap/Cargo.lock Reflects new dependency graph and the intended registry+git libdd-* duplication.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bottlecap/src/appsec/processor/context.rs Outdated
Comment thread bottlecap/src/traces/trace_processor.rs Outdated
@lucaspimentel lucaspimentel changed the title chore(deps): update libdatadog to 72fa8685 and serverless-components to 9daae40 chore(deps): update libdatadog to 72fa8685 and serverless-components to 9daae40 Aug 19, 2026
@lucaspimentel
lucaspimentel force-pushed the lpimentel/bump-libdatadog-72fa8685 branch from a3a610b to 5110d8d Compare August 20, 2026 19:37
lucaspimentel added a commit that referenced this pull request Aug 21, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
@lucaspimentel
lucaspimentel force-pushed the lpimentel/bump-libdatadog-72fa8685 branch from 5110d8d to 7996ec2 Compare August 21, 2026 21:46
@lucaspimentel
lucaspimentel requested a balanced review from Copilot August 21, 2026 21:55

Copilot AI 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.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Comment thread bottlecap/src/traces/stats_concentrator_service.rs
lucaspimentel added a commit that referenced this pull request Aug 21, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Aug 21, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
@lucaspimentel
lucaspimentel force-pushed the lpimentel/bump-libdatadog-72fa8685 branch from 7996ec2 to b7ea62c Compare August 25, 2026 13:23
lucaspimentel added a commit that referenced this pull request Aug 25, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Aug 25, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖

@litianningdatadog litianningdatadog 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.

LGTM. Will we release only after the whole stack is merged? By the time do we plan to restore patch.crates-io section to avoid dup libs in binary?

@lucaspimentel

lucaspimentel commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@litianningdatadog

Will we release only after the whole stack is merged?

Not the whole stack necessarily. First I needed to do some version bumps and dependency management (#1332, this PR). Bumping those versions pulled in some upstream changes that needed to be handled as well, so I did that in #1338. I kept them in separate PRs so it was (hopefully!) easier to review. I will merge them into main together so they get released together.

The other two PRs are the ones that add new features. These are more independent and don't necessarily have to be in the same release:
#1320 - add error sampler (requires #1332)
#1336 - added span-derived primary tags (requires #1338)


By the time do we plan to restore patch.crates-io section to avoid dup libs in binary?

I don't have a timeline for this. Short term, restoring the patch.crates-io section is conditional on two things landing upstream: libdatadog's libdd-common reaching the 5.2.0 floor that the published libdd-data-pipeline requires, and the unreleased libdd-telemetry breaking change shipping in an actual release.

Long-term, we need to do some refactoring to avoid dependency issues like these. For example, datadog-opentelemetry (from repo dd-trace-rs) is the only dependency that duplicates the libdd-* graph, and what bottlecap actually uses from it is the propagation subsystem. If we migrated that propagation subsystem into libdatadog itself, bottlecap wouldn't need datadog-opentelemetry as a direct dependency at all, which would remove the root cause of the patch.crates-io problem.

@lucaspimentel

Copy link
Copy Markdown
Member Author

Also, for reference, this whole version bump (which includes the duplication of the libdd-* crates) added about 45 KB (+0.39%) to the unpacked layer binary, most of which is probably from that code duplication. See the PR description.

lucaspimentel added a commit that referenced this pull request Aug 25, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Aug 25, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
lucaspimentel added a commit that referenced this pull request Aug 26, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Aug 26, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
lucaspimentel and others added 6 commits August 28, 2026 08:50
… hold path as one struct

HoldArguments flattened all 10 TracerHeaderTags fields with a
tracer_header_tags_ prefix, purely to own the Strings across the hold
boundary. OwnedTracerHeaderTags already does that job, so collapse the
10 fields into a single header_tags: OwnedTracerHeaderTags.

No functional change.
…to 9daae40

No functional change intended. Bumps bottlecap's 7 direct libdatadog
dependencies from 85ce322a to 72fa8685, and its 3 serverless-components
dependencies (dogstatsd, datadog-fips, datadog-agent-config) from d0c7f44
to 9daae40, which pins the same libdatadog rev. Both bumps land together
because SCL's Cargo.lock at d0c7f44 pinned libdatadog to 85ce322a; bumping
only one side leaves the two `ReplaceRule` types structurally identical
but resolved as different crate instances, which rustc rejects.

Header-tag regrouping: libdatadog #2279 split `TracerHeaderTags`'s four
plain-value fields (client_computed_stats, client_computed_top_level,
dropped_p0_traces, dropped_p0_spans) into a nested TracerGenericTags.
Mechanical follow-through at every construction site and the three field
reads that touched them directly.

SpanConcentrator::new signature: 5th param changed from
`override_max_entries_per_bucket: Option<usize>` to
`override_cardinality_limits: Option<CardinalityLimitConfig>`, plus a new
6th `additional_metric_tag_keys: Vec<String>` param. Stats cardinality
limits are explicitly pinned (whole_key_limit: usize::MAX, all four
per-field limits: usize::MAX - 1) to preserve bottlecap's pre-existing
unbounded aggregation; passing None would silently opt into the new
default caps (7000 whole-key, 1024 resource, etc.) and collapse
high-cardinality Lambda stats into the tracer_blocked_value overflow
bucket.

`[patch.crates-io]` removed: rev 72fa8685 carries an unreleased breaking
libdd-telemetry change under an unchanged crate version, which makes
dd-trace-rs's datadog-opentelemetry v0.5.0 fail to build against a
patched libdd-telemetry. Letting the tracer resolve libdd-* from
crates.io (the arrangement serverless-components already uses) avoids
that, at the cost of 11 duplicated libdd-* crates in the dependency
graph. bottlecap's own libdd-trace-stats no longer enables
stats-obfuscation as a side effect (that feature arrived only via the
now-deleted patch's crate-id unification), which is why
SpanConcentrator::new above drops its obfuscation argument entirely
rather than gaining a 7th parameter.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Build the held-trace sender by spreading the existing processor instead of
copying each field, so it does not need updating when a field is added.

Also document why the libdd-* crates are no longer deduplicated via
`[patch.crates-io]`, and how to re-check when bumping libdatadog or dd-trace-rs.

🤖
@lucaspimentel
lucaspimentel force-pushed the lpimentel/bump-libdatadog-72fa8685 branch from 52491e1 to 170b096 Compare August 28, 2026 12:51
@lucaspimentel
lucaspimentel merged commit 657cd54 into main Aug 28, 2026
63 checks passed
@lucaspimentel
lucaspimentel deleted the lpimentel/bump-libdatadog-72fa8685 branch August 28, 2026 17:19
smithclay added a commit to usetero/datadog-lambda-extension that referenced this pull request Sep 1, 2026
* fix(deps): bump h2 to 0.4.18 to fix RUSTSEC-2026-0258 (DataDog#1335)

The **Audit** check (`cargo-audit`) is failing on `main`:
[RUSTSEC-2026-0258](https://rustsec.org/advisories/RUSTSEC-2026-0258) —
`h2` accepts and queues empty DATA frames without limit, which can lead
to unbounded memory usage or a panic on length overflow. Low severity,
patched in `h2` 0.4.16.

This bumps `h2` 0.4.13 → 0.4.18 in `bottlecap/Cargo.lock`.
Lockfile-only; no source changes.

Notes on the diff:
- The diff is restricted to the two `h2` lines. Running `cargo update -p
h2` locally also re-resolved six unrelated `windows-sys` entries
downward (0.61.2 → 0.52.0/0.60.2); that churn was reverted, and `cargo
metadata --locked` confirms the lockfile is still self-consistent.

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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* [SVLS-8070] Remove dormant GHCR publisher (DataDog#1330)

## Overview
* Removes the dormant GHCR publisher; companion to
https://github.com/DataDog/serverless-init-ci/pull/51
* Updates Bottlecap's locked `h2` dependency from 0.4.13 to 0.4.16 to
resolve
[RUSTSEC-2026-0258](https://rustsec.org/advisories/RUSTSEC-2026-0258),
which is blocking `main` and unrelated PRs

## Testing
* `cargo check --workspace --locked`

* chore: add PR size guidance to AGENTS.md (DataDog#1331)

## Overview

Adds a line to `AGENTS.md` asking agents to keep PRs small — usually no
more than 300 lines of core code, excluding tests, dependency updates,
and other generated changes — so reviews stay manageable.

## Testing

Docs-only change; no code affected.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat(dsm): Add support for automatic DSM context extraction inside the extension (DataDog#1265)

**Please include Jira ticket in title.**

Update the trace context propagation support in universal
instrumentation to include the automatic extraction of Data Streams
Monitoring context for SQS, SNS, Kinesis and EventBridge.

Added unit tests. Manually tested the functionality for Java, Go and
.NET. Java and Go work correctly. [The .NET tracer needs updating to
support the 2.x version of
`Amazon.Lambda.RuntimeSupport`](DataDog/dd-trace-dotnet#8797)
so can't test that manually yet.

* feat(traces): use DD_SERVICE for inferred spans when integration service names are removed (DataDog#1343)

## Summary

- Adds `DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED` (default
`false`). When it is set **and** `DD_SERVICE` is configured, inferred
(synthetic) event-source spans report the function's base service
instead of the AWS resource/instance representation.
- An explicit `DD_SERVICE_MAPPING` entry still takes precedence.
- Applies to the wrapped inferred spans too (SQS→SNS, SQS→EventBridge,
SNS→EventBridge).

## Motivation

Customers currently need one `DD_SERVICE_MAPPING` entry per trigger type
per function to get their event-source spans onto their own service
name. This gives them a single setting that consolidates all of them at
once.

Tracked by
[FRSLES-869](https://datadoghq.atlassian.net/browse/FRSLES-869). This
repo is the **only** inferred-span implementation for Go, Java, .NET,
and Ruby, which delegate inference to the extension entirely. Companion
PRs:
[datadog-lambda-python#834](DataDog/datadog-lambda-python#834),
[datadog-lambda-js#814](DataDog/datadog-lambda-js#814).

## Implementation note

Rather than thread two more parameters through `Trigger::enrich_span`
and `resolve_service_name` (a ~200-line mechanical change across all 13
trigger modules and their tests), the override is applied in
`span_inferrer.rs` immediately after enrichment.

To keep `DD_SERVICE_MAPPING` precedence expressed in one place,
`Trigger` gains a default `has_service_mapping_entry` method that reuses
the same specific/generic identifiers `resolve_service_name` looks up.
Happy to switch to the full parameter-threading approach if reviewers
prefer a single resolution ladder.

The override lowercases `DD_SERVICE` to match the invocation span built
in `processor.rs`, so both spans land on the same service.

## Scope

Service-name resolution only. `complete_inferred_spans` still sets
`peer.service` to the invocation span's service as it does today;
revisiting that pairing is deliberately left to a follow-up.

## Test plan

- [x] 6 new tests in `span_inferrer.rs`: override applies, disabled by
default, yields to `DD_SERVICE_MAPPING`, no-op without `DD_SERVICE`,
lowercases `DD_SERVICE`, applies to wrapped spans
- [x] 3 new config tests: default off, from env, from YAML
- [x] `cargo test --lib` — 550 passed
- [x] `cargo clippy --lib --tests -- -D warnings` clean
- [x] `cargo fmt --check` clean

[FRSLES-869]:
https://datadoghq.atlassian.net/browse/FRSLES-869?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

* chore(deps): update `libdatadog` to `72fa8685` and `serverless-components` to `9daae40` (DataDog#1332)

---------

Co-authored-by: Yiming Luo <10097700+lym953@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: E. Lewis <lewis.lewis@datadoghq.com>
Co-authored-by: James Eastham <dev@jameseastham.co.uk>
Co-authored-by: Zarir Hamza <zarir.hamza@datadoghq.com>
Co-authored-by: Lucas Pimentel <lucas.pimentel@datadoghq.com>
lucaspimentel added a commit that referenced this pull request Sep 1, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Sep 1, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
lucaspimentel added a commit that referenced this pull request Sep 3, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Sep 3, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
lucaspimentel added a commit that referenced this pull request Sep 3, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Sep 3, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
lucaspimentel added a commit that referenced this pull request Sep 3, 2026
Wire DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, DD_TRACE_STATS_ADDITIONAL_TAGS,
and DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT into
StatsConcentratorService, matching the Serverless Compatibility Layer
(datadog-trace-agent). Lets users configure span meta keys as additional
stats aggregation dimensions (ClientGroupedStats.additional_metric_tags),
gated behind the experimental features flag.

libdd-trace-stats (pinned via #1332) already implements
additional_metric_tag_keys end-to-end; this only adds the bottlecap-side
config plumbing. The deprecated span_derived_primary_tags proto field
(superseded by additional_metric_tags) intentionally stays empty.

Depends on #1332 (libdatadog/serverless-components rev bump); base this
branch on lpimentel/bump-libdatadog-72fa8685 until that merges.
lucaspimentel added a commit that referenced this pull request Sep 3, 2026
The excess-key warning predicted libdatadog's normalization instead of
reading it: a hand-copied `MAX_ADDITIONAL_METRIC_TAG_KEYS = 4` mirroring
a private upstream constant, plus a local re-implementation of its
sort/dedup/truncate. Both could drift silently, and the copy would then
name the wrong keys as dropped.

libdatadog already exposes the survivors via
`SpanConcentrator::additional_metric_tag_keys()`, so ask for them
instead: diff the requested list against the kept list, move the warning
to after `SpanConcentrator::new`, and delete the constant and the mirror.
The effective cap is now `kept.len()` rather than a number we assert on
faith.

The reworked test builds a real concentrator and checks which keys
survive, so it exercises upstream's actual rule -- and confirms the cap
is in fact 4, which nothing previously verified.

Also drop the #1332 reference from the `resolve_cardinality_limits` doc
comment; it is stale once that PR merges, and the rationale reads better
stated directly.

🤖
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