Add decoded span assert rules - #12088
Conversation
Bits has a CI fix ready🟢 Investigated · 🟢 Fix prepared · ⚪ Validation skipped · 🟠 Ready
View in Datadog | Reviewed commit 5134699 · Any feedback? Reach out in #deveng-pr-agent |
There was a problem hiding this comment.
Please try again by commenting @autotest review.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 513469965b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
5134699 to
d7f5363
Compare
|
@autotest review |
There was a problem hiding this comment.
Unordered trace matching can reject a valid trace when a reusable childOfPrevious matcher first probes a non-matching candidate: assertSpan mutates the matcher to that candidate's parent ID, so later candidates are checked against stale state. Keep the resolved parent matcher local instead of mutating the configured matcher.
🤖 Datadog Autotest · Commit d7f5363 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
d7f5363 to
798798a
Compare
There was a problem hiding this comment.
More details
The decoder and assertion paths do not show a confirmed behavioral regression or diff-only production hazard. Adversarial cases were reviewed for malformed JSON, unsigned IDs, missing fields, duplicate/unordered trace matching, ancestry ordering, partial trace chunks, and nested meta_struct values; execution was blocked before tests ran because the checkout requires JDK 25 and the sandbox has only JDK 8/11/17/21.
🤖 Datadog Autotest · Commit 798798a · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 798798ab44
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
798798a to
1004c0a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1004c0a40d
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @Json(name = "meta_struct") | ||
| Map<String, Object> metaStruct; |
There was a problem hiding this comment.
Normalize numeric meta_struct values across decoders
When a meta_struct entry contains numeric leaves, Moshi's generic Object adapter materializes them as Double, while the existing msgpack decoder returns Long for integers and Float for floating-point values in SpanV04.convertValueToObject (SpanV04.java:204-207). Consequently, an exact metaStruct(..., is(expected)) matcher or a predicate casting a numeric leaf can pass with the in-process backend and fail with the dd-apm-test-agent JSON backend; decode these nested numbers into the same representation before exposing the shared DecodedSpan model.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
More details
The decoded-span assertion layer matches the intended behavior for positional, sorted, ancestry-based, unordered, parent-link, default-constraint, and meta_struct checks. No diff-only regression was confirmed; focused Gradle execution was attempted but the sandbox lacks JDK 25 and cannot download it, so validation is limited to source analysis and existing test coverage.
🤖 Datadog Autotest · Commit 1004c0a · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
1004c0a to
8583373
Compare
fa90299 to
8ff8af2
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85833735e9
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| private SpanMatcher() { | ||
| this.serviceMatcher = validates(s -> s != null && !s.isEmpty()); | ||
| this.typeMatcher = isNull(); |
There was a problem hiding this comment.
Accept empty wire types as absent
When an untyped span is decoded from v0.5 or v1 input, getType() returns "", not null: TraceMapperV0_5.writeDictionaryEncoded serializes null strings as empty strings, and SpanV1.unpack initializes an omitted type to "". Consequently the default span() matcher rejects ordinary untyped spans from these backends, even though the same span passes when decoded from the JSON fixture used by this commit's tests. Normalize absent types or make the default matcher accept both null and empty strings so assertions behave consistently across supported decoded formats.
Useful? React with 👍 / 👎.
8ff8af2 to
3e09e7c
Compare
8583373 to
d100b5a
Compare
What Does This Do
This PR introduces decoded span assert rules.
EDIT: This PR unit tests need test agent JSON span deserialization first. I’ll introduce an intermediate PR to the stack to add it. It is still good to review in the meantime.
Motivation
The goal is to provide capabilities for smoke tests to evaluate trace and span structures and values.
Additional Notes
This is mainly inspired from my prior work with instrumentation tests but decoded spans are not like DDSpan. They don’t hold the same values / types so new rules needed to be put in place for smoke tests.
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: APMLP-1247