Skip to content

Relaxed test to pass for Java tracer.#6394

Open
AlexeyKuznetsov-DD wants to merge 1 commit intomainfrom
alexeyk/relaxed-test-v1-payload
Open

Relaxed test to pass for Java tracer.#6394
AlexeyKuznetsov-DD wants to merge 1 commit intomainfrom
alexeyk/relaxed-test-v1-payload

Conversation

@AlexeyKuznetsov-DD
Copy link
Contributor

Motivation

Java tracer produces a bit different traces than go tracer, this PR relaxed V1 payload test to pass on java too.

Changes

Changed several asserts.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD self-assigned this Feb 27, 2026
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD requested a review from a team as a code owner February 27, 2026 19:41
@github-actions
Copy link
Contributor

CODEOWNERS have been resolved as:

tests/test_v1_payloads.py                                               @DataDog/system-tests-core

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8d038c614

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

_, trace = library_traces[0]
assert isinstance(trace.raw_trace, dict)
assert len(trace.raw_trace["spans"]) == 1
assert len(trace.raw_trace["spans"]) > 0 # various tracers can return different number of spans

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Identify the server span before asserting span fields

By relaxing len(trace.raw_trace["spans"]) to > 0, this test now allows multi-span traces but still validates only trace.spans[0] for error, env, component, and span_kind; when Java emits multiple spans, span ordering is not guaranteed, so the first span can be a child span and these assertions fail even though the trace is valid. This makes the test flaky/incorrect for the exact Java payload shape this change is trying to support.

Useful? React with 👍 / 👎.

assert span.raw_span["error"], "Error field must be boolean"
assert span.raw_span["env"] == "system-tests"
assert span.raw_span["component"] == "net/http"
assert span.raw_span["component"] in (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can probably just assert that it's non-empty here. There's already a test in test_semantic_conventions that will verify the exact value (and has a lot more logic to cover all the libs and langs)

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.

2 participants