Skip to content

More v1 tests to improve coverage#6666

Open
ajgajg1134 wants to merge 3 commits intomainfrom
andrew.glaude/Morev1Tests
Open

More v1 tests to improve coverage#6666
ajgajg1134 wants to merge 3 commits intomainfrom
andrew.glaude/Morev1Tests

Conversation

@ajgajg1134
Copy link
Copy Markdown
Contributor

@ajgajg1134 ajgajg1134 commented Mar 31, 2026

Motivation

Closes coverage gaps identified in the V1 trace payload coverage report. The V1 (/v1.0/traces) format introduced indexed string tables, typed AnyValue attributes, and top-level span links/events. Several attribute types and span-level fields had no test coverage at any layer.

I had to add span event support to the orchestrion weblog, which might be the wrong move here? In which case let me know go team and I can either adjust the implementation or just mark this test as skipped for the orchestrion weblog

Changes

utils/proxy/traces/trace_v1.py

  • Add _uncompress_key_value_list() to recursively resolve keyValueList (type 7) AnyValue attributes — the only AnyValue variant that was completely unhandled by the deserializer.
  • Wire it into _attributes_to_dict() so type-7 attributes deserialize to a nested dict instead of being passed through raw.

tests/test_the_test/test_deserializer.py

  • Add test_deserialize_v1_trace_key_value_list_attribute: unit test verifying that a keyValueList-typed span attribute round-trips correctly through the Python deserializer. Includes a # TODO(v1-kvlist-e2e) tracking comment for the future E2E test once a tracer emits this type.

tests/test_v1_payloads.py — three new E2E test classes, all under @scenarios.apm_tracing_efficient_payload:

  • Test_V1SpanLinks: injects conflicting W3C + Datadog trace context via /make_distant_call to force span link creation, then asserts the deserialized link has a hex trace_id and integer span_id.
  • Test_V1SpanEvents: calls /add_event and asserts the root span carries at least one event with time_unix_nano and name fields in the deserialized V1 form.
  • Test_V1TopLevelSpans: calls /status?code=200 and asserts every root span has _dd.top_level=1 in its V1 attributes map (required for correct agent-side priority sampling).

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?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

CODEOWNERS have been resolved as:

tests/test_the_test/test_deserializer.py                                @DataDog/system-tests-core
tests/test_v1_payloads.py                                               @DataDog/system-tests-core
utils/build/docker/golang/app/net-http-orchestrion/main.go              @DataDog/dd-trace-go-guild @DataDog/system-tests-core
utils/proxy/traces/trace_v1.py                                          @DataDog/system-tests-core

@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 bot commented Mar 31, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 1 Test failed

tests.remote_config.test_remote_configuration.Test_RemoteConfigurationUpdateSequenceLiveDebugging.test_tracer_update_sequence[apache-mod-7.2] from system_tests_suite   View in Datadog   (Fix with Cursor)
Exception: ("client is not expected to have cached config but is reporting cached config: [{'path': 'datadog/2/LIVE_DEBUGGING/metricProbe_33a64d99-fbed-5eab-bb10-80735405c09b/config', 'length': 360, 'hashes': [{'algorithm': 'sha256', 'hash': '6daaa0eb13996d340d99983bb014ef17453bad39edf19041f24a87a159ff94fe'}]}, {'path': 'datadog/2/LIVE_DEBUGGING/logProbe_22953c88-eadc-4f9a-aa0f-7f6243f4bf8a/config', 'length': 239, 'hashes': [{'algorithm': 'sha256', 'hash': '8176095e451a5f4d49db40e5eadf7d79b0ca6956cf28c83f87d18f4d66ea2583'}]}]", 'SUCCESS - Remove the initial config. RFC about integrating with remote-config: https://docs.google.com/document/d/1u_G7TOr8wJX0dOM_zUDKuRJgxoJU_hVTd5SeaMucQUs')

self = <tests.remote_config.test_remote_configuration.Test_RemoteConfigurationUpdateSequenceLiveDebugging object at 0x7f4675708b60>

    def test_tracer_update_sequence(self):
        """Test update sequence, based on a scenario mocked in the proxy"""
    
        # Index the request number by runtime ID so that we can support applications
        # that spawns multiple worker processes, each running its own RCM client.
        request_number: dict = defaultdict(int)
...

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 36e644a | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@ajgajg1134 ajgajg1134 marked this pull request as ready for review April 1, 2026 20:08
@ajgajg1134 ajgajg1134 requested review from a team as code owners April 1, 2026 20:08
Copy link
Copy Markdown

@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: 36e644ab99

ℹ️ 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".

assert len(spans_with_links) >= 1, "Expected at least one span with span links"

link_carrier = spans_with_links[0]
links = link_carrier.raw_span.get("span_links") or []
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Parse attribute-backed span links before asserting fields

This test collects spans when links are present either in span_links or in attributes._dd.span_links, but then it reads links only from span_links. In runs where the tracer reports links through _dd.span_links (which is already treated as a valid v1 representation elsewhere, e.g. tests/test_distributed.py), spans_with_links will be non-empty but links becomes [], causing a false failure on assert len(links) >= 1 even though links were present.

Useful? React with 👍 / 👎.


def test_root_span_is_top_level(self):
"""The root span of a trace must be marked as top-level"""
for _, root_span in interfaces.library.get_root_spans(self.r):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require at least one root span in top-level validation

The test iterates over interfaces.library.get_root_spans(self.r) without first asserting that any root span was found. If trace correlation fails or no root span is captured for that request, the loop body never executes and the test passes vacuously, so regressions in _dd.top_level tagging can be missed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

@nccatoni nccatoni left a comment

Choose a reason for hiding this comment

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

LGTM (for @DataDog/system-tests-core) but you should get a review from someone familiar with the feature

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