Skip to content

Add span event assertions to smoke tests - #12934

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
bbujon/span-events-assert
Oct 22, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
bbujon/span-events-assert

Conversation

@PerfectSlayer

@PerfectSlayer PerfectSlayer commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

What Does This Do

Adds span event assertions to smoke tests, mirroring span links:

span()
    .operationName("Application.loadConfiguration")
    .events(event("configuration-loaded"))

Decoder (utils/test-agent-utils/decoder)

  • DecodedSpan.getEvents() exposes decoded span events (name, time, typed attributes) for every protocol:

    Source Events come from
    v0.4 / v0.5 msgpack the events meta tag
    test agent JSON, v0.4 tracer payload the events meta tag, kept as-is by the agent
    test agent JSON, v1.0 tracer payload the span_events field, with typed attribute values
    v1.0 msgpack span field 12

Attribute values decode to String, Boolean, Long, Double, or a List of them, whatever the source and malformed events fail decoding with an explicit error, as malformed links do.

Smoke DSL (dd-smoke-tests)

  • SpanEventMatcher: event(name), .time(...), .attributes(...). By default, an event has no attribute and its time is within the span bounds.
  • SpanMatcher.events(...) matches events positionally and count-exact; events() asserts none, and not calling it asserts nothing, like links(...).

OpenTelemetrySmokeTest now asserts .events(event("configuration-loaded")) instead of searching the events tag string.

Motivation

Smoke tests could only check events by inspecting the events tag string, which does not exist with the v1.0 protocol where events are structured. This aligns smoke tests with the JUnit trace assertions (#12810).

Additional Notes

  • The v1.0 decoder used to skip field 12 blindly, which consumed any string the events introduced without registering it, desynchronizing the string table for the rest of the payload. It now decodes the events through the string table.
  • The JSON span_events shape was captured from a real dd-apm-test-agent (v1.64.1) run and is kept as the span-events-v1.json fixture.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

🤖 Generated with Claude Code

@PerfectSlayer PerfectSlayer added type: feature Enhancements and improvements comp: testing Testing tag: no release notes Changes to exclude from release notes tag: ai generated Largely based on code generated by an AI or LLM labels Oct 19, 2026
@PerfectSlayer
PerfectSlayer marked this pull request as ready for review October 19, 2026 15:51
@PerfectSlayer
PerfectSlayer requested review from a team as code owners October 19, 2026 15:51
@PerfectSlayer
PerfectSlayer requested review from sarahchen6 and vpellan and removed request for a team October 19, 2026 15:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T15:55:11.697223Z 804af45 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-19T15:55:41.746674Z 804af45 Draft marked ready
ℹ️ 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.

@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: FAIL

Legacy event decoding accepts trailing JSON garbage, so smoke assertions can pass on malformed serialized events. The parser needs to consume the complete document, including the JSON-null path.

Open Bits AI session

🤖 Bits Code Review · Commit 804af45

@datadog-datadog-prod-us1

This comment has been minimized.

@PerfectSlayer
PerfectSlayer force-pushed the bbujon/span-events-assert branch from 804af45 to cc04271 Compare October 19, 2026 16:05
@dd-octo-sts

dd-octo-sts Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.92 s 13.95 s [-0.8%; +0.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.84 s 12.95 s [-1.8%; +0.1%] (no difference)
startup:petclinic:appsec:Agent 17.09 s 17.02 s [-0.7%; +1.4%] (no difference)
startup:petclinic:iast:Agent 16.96 s 16.92 s [-0.5%; +1.1%] (no difference)
startup:petclinic:profiling:Agent 16.72 s 16.72 s [-1.2%; +1.2%] (no difference)
startup:petclinic:sca:Agent 16.99 s 16.97 s [-0.7%; +0.9%] (no difference)
startup:petclinic:tracing:Agent 16.02 s 16.12 s [-1.6%; +0.4%] (no difference)

Commit: f2f17f50 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

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

Looks reasonable!

cc @AlexeyKuznetsov-DD if you want to take a look

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD 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, left some comments, can be applied as follow ups if they make sense.

Comment thread dd-smoke-tests/src/test/java/datadog/smoketest/trace/SmokeMatcherTest.java Outdated
@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-21 16:21:28 UTC ℹ️ Start processing command /merge


2026-10-21 16:21:39 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-10-21 17:04:14 UTC ⚠️ MergeQueue: This merge request was unqueued

bruce.bujon@datadoghq.com unqueued this merge request

@PerfectSlayer

Copy link
Copy Markdown
Collaborator Author

/merge -c

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-21 17:04:09 UTC ℹ️ Start processing command /merge -c

@PerfectSlayer

Copy link
Copy Markdown
Collaborator Author

I'll have a look a look at the feedback first :)

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor

I'll have a look a look at the feedback first :)

@PerfectSlayer Sorry, I triggered it by mistake, thanks for canceling it.

@PerfectSlayer
PerfectSlayer force-pushed the bbujon/span-events-assert branch from cc04271 to f2f17f5 Compare October 22, 2026 09:17
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 06bcfd3 into master Oct 22, 2026
608 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the bbujon/span-events-assert branch October 22, 2026 11:24
@github-actions github-actions Bot added this to the 1.68.0 milestone Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants