Support agent-side v1 trace payload conversion in tests - #7626
Merged
Conversation
The trace agent can convert incoming v0.4 payloads to the efficient trace payload format (idxTracerPayloads) before forwarding them. Three test groups still assumed the legacy agent payload shape and broke under that conversion. These changes are format-agnostic: they pass both with an agent that converts and with one that does not. Config consistency: the efficient format merges meta and metrics into a single typed `attributes` map, so a tag a tracer reports both as a string tag and as a numeric metric collides, and the numeric value survives. The Rust tracer does this for http.status_code, giving `assert 400.0 == '400'`. Add DataDogAgentSpan.get_tag(), which normalizes integral numbers back to their string form for that format only; the legacy format keeps meta and metrics separate, so values are returned untouched there and a numeric value in meta remains a failure, as it should. Exception replay (java): a converted span carries a `_dd.convertedv1` provenance marker, and v0.4 `meta` values stay strings where a natively emitted v1 payload keeps real booleans. Drop the marker and canonicalize booleans on both sides of the approval comparison, so a single set of approval files stays valid either way. Normalizing is preferred over re-recording the baselines, which would bake the current conversion path into them. Code origin (python): `_wait_for_code_origin_span` indexed the raw payload with legacy-only keys (`tracerPayloads`, `resource`, `type`, `meta`), so under v1 it never matched a span and timed out into a misleading "code origin not enabled" assertion. Iterate `interfaces.agent.get_spans()` instead, whose typed wrappers resolve those fields for both formats. Exception replay (php): the `*_spans_expected_v1.json` approvals were never generated, so the tests raised FileNotFoundError. Recorded them into the existing 1.18.0 folder alongside the legacy files. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
|
ajgajg1134
marked this pull request as ready for review
September 1, 2026 17:08
There was a problem hiding this comment.
More details
The format-specific accessors preserve legacy values and normalize only efficient payload tags. The new approval data covers each enabled PHP exception replay test.
🤖 Datadog Autotest · Commit e538227 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
🎉 All green!🧪 All tests passed 🔗 Commit SHA: e538227 | Docs | View more details | Give us feedback! |
cbeauchesne
approved these changes
Sep 2, 2026
cbeauchesne
left a comment
Collaborator
There was a problem hiding this comment.
AGTM. I advise you to get a review from someone in debugger team
tylfin
approved these changes
Sep 2, 2026
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.
Motivation
The trace agent can convert incoming v0.4 payloads to the efficient trace payload format (
idxTracerPayloads) before forwarding them. Three test groups still assumed the legacy agent payload shape and broke under that conversion.These changes are format-agnostic: they pass both with an agent that converts and with one that does not, so they can land ahead of the agent change.
Changes
Config consistency — the efficient format merges
metaandmetricsinto a single typedattributesmap, so a tag a tracer reports both as a string tag and as a numeric metric collides, and the numeric value survives. The Rust tracer does this forhttp.status_code, producingassert 400.0 == '400'while every other library passed. AddsDataDogAgentSpan.get_tag(), which normalizes integral numbers back to their string form for that format only. The legacy format keepsmetaandmetricsseparate, so values are returned untouched there and a numeric value inmetaremains a failure, as it should.Exception replay (java) — a converted span carries a
_dd.convertedv1provenance marker, and v0.4metavalues stay strings where a natively emitted v1 payload keeps real booleans. Drop the marker and canonicalize booleans on both sides of the approval comparison, so a single set of approval files stays valid either way. Normalizing is preferred over re-recording the baselines, which would bake the current conversion path into them.Code origin (python) —
_wait_for_code_origin_spanindexed the raw payload with legacy-only keys (tracerPayloads,resource,type,meta), so under v1 it never matched a span and timed out into a misleading "code origin not enabled" assertion. Now iteratesinterfaces.agent.get_spans(), whose typed wrappers resolve those fields for both formats.Exception replay (php) — the
*_spans_expected_v1.jsonapprovals were never generated, so the tests raisedFileNotFoundError. Recorded into the existing1.18.0folder alongside the legacy files.Compatibility
_v1approval suffix is selected at runtime from the observed span format, so a legacy-format agent still reads the untouchedspans_expectedfiles._dd.convertedv1is a no-op when the marker is absent.get_tagis gated on the format enum, so legacy behavior is unchanged.Validation
Carried over from the exploratory branch, validated per language with the converting agent and with the default agent, confirming the payload format in each run via the captured agent interface files:
DEBUGGER_EXCEPTION_REPLAYDEBUGGER_INPRODUCT_ENABLEMENTDEBUGGER_EXCEPTION_REPLAYget_tagverified in replay mode against the rust/axum CI artifact: the two failing tests pass and the fullDEFAULTscenario matches CI exactly (67 passed / 386 skipped / 43 xfailed / 3 xpassed) with no other change.ruff check,ruff format --check, andmypypass on the changed Python files.🤖 Generated with Claude Code