[APMSVLS-485] Send region as a trace stats tag by default - #1345
Closed
lucaspimentel wants to merge 1 commit into
Closed
[APMSVLS-485] Send region as a trace stats tag by default#1345lucaspimentel wants to merge 1 commit into
lucaspimentel wants to merge 1 commit into
Conversation
With DD_LAMBDA_EXTENSION_COMPUTE_STATS enabled the extension aggregates trace stats itself, so the backend never sees full spans and can only use the tags sent on the stats payload. Any org-designated primary tag was silently lost on Lambda trace stats as a result. The extension now sends `region` as an additional trace stats tag by default, so it keeps working as a primary tag when the extension computes stats. The value is already parsed from the function ARN, so this adds one value per function and no new cardinality. Setting DD_TRACE_STATS_ADDITIONAL_TAGS replaces the default rather than adding to it, so a user who wants `region` alongside their own keys lists it explicitly. Keeping the two separate avoids spending one of the four available keys on a tag the user did not ask for. The default is not subject to DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED, which exists to gate user-configured keys of unknown cardinality. 🤖
|
Member
Author
|
Oops, my mistake. This is wrong. We don't send |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please include Jira ticket in title.
Overview
Stacked on #1336. Review that one first; this PR is the last commit only.
With
DD_LAMBDA_EXTENSION_COMPUTE_STATSenabled the extension aggregates trace stats itself. The backend then never sees full spans, so it can only use the tags the extension puts on the stats payload, and any tag an org has designated as a primary tag was silently lost on Lambda trace stats. Customers who enabled the setting lost those dimensions ontrace.aws.lambdawithout any indication.This is also what is behind the two xfailed
regionprimary-tag tests in serverless-e2e-tests#319. Those tests do not measure the tracer, they measure who computed the stats.The extension now sends
regionas an additional trace stats tag by default, so it keeps working as a primary tag when the extension computes stats. The value is already parsed from the function ARN and copied into every span, so this adds one value per function and no new cardinality: the aggregation key gains a constant dimension, not a multiplier.Interaction with
DD_TRACE_STATS_ADDITIONAL_TAGSSetting it replaces the default rather than adding to it:
DD_TRACE_STATS_ADDITIONAL_TAGSDD_TRACE_EXPERIMENTAL_FEATURES_ENABLED["region"]["region"]tenant_id["tenant_id"]region,tenant_id["region", "tenant_id"]region,tenant_id["region"]A user who wants
regionalongside their own keys lists it explicitly. Replacing rather than merging keeps the change clear of the four-key limit on additional stats tags: a one-key default never approaches it, and an explicit list is passed through exactly as written, so users still get all four slots. Merging would have spent one of them on a key the user did not ask for, and since keys over the limit are dropped in alphabetical order rather than by intent,regionsorts late enough that it would often have been the one dropped anyway.The default is deliberately not subject to
DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED. That gate exists to keep user-configured keys of unknown cardinality behind a flag;regionis neither user-configured nor unbounded.Note that
apply_experimental_features_gateresets to the default rather than clearing. It is the only reset path and runs on everyget_config, so clearing there would make the default unreachable in production while still looking correct in tests built fromConfig::default().Testing
cargo test --lib,cargo clippy --all-targets -- -D warningsandcargo fmt --checkare clean.Unit tests cover the default reaching the resolved config, the default surviving a disabled experimental gate (the production path, via
get_configrather thanConfig::default()), an explicit setting replacing the default, andregionsurfacing on exported stats from a span that carries it.Still to do before this leaves draft:
DD_EXTENSION_ARN), since serverless-e2e-tests pins a published layer.statsv2rows inFEATURE-PARITY.md. Separate PR, after this ships in a released layer.🤖