Relaxed test to pass for Java tracer.#6394
Conversation
|
|
There was a problem hiding this comment.
💡 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 |
There was a problem hiding this comment.
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 ( |
There was a problem hiding this comment.
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)
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
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present