fix(ci_visibility): add ITR correlation ID#19141
Conversation
🎉 All green!🧪 All tests passed 🔄 Datadog auto-retried 1 job - 1 passed on retry 🔗 Commit SHA: 339b40a | Docs | Datadog PR Page | Give us feedback! |
Codeowners resolved as |
Circular import analysis
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bad4f0d908
ℹ️ 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".
| skipping_enabled=self.settings.skipping_enabled, | ||
| skipping_level=self.itr_skipping_level, | ||
| ) | ||
| self.session.itr_correlation_id = self.itr_correlation_id |
There was a problem hiding this comment.
Preserve the existing ITR payload metadata
When the skippable endpoint returns a correlation ID, this now stores it only on TestSession for event serialization, but the previous writer.add_metadata("test"/"test_suite_end", {"itr_correlation_id": ...}) call was removed. That means citestcycle payloads no longer include the existing metadata["test"] or metadata["test_suite_end"] correlation ID, which is a backward-compatibility regression for any backend path still reading the payload metadata while this change adds the new content.itr_correlation_id field. Re-add the metadata emission in addition to this session propagation.
Useful? React with 👍 / 👎.
E2E Test Results ✅Tested on the flask playground (12,381 tests, 554 suites) against mockdog with the TEST-level mode (default)
SUITE-level mode (
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bad4f0d908
ℹ️ 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".
| "test_module_id": test_run.module.item_id, | ||
| "test_suite_id": test_run.suite.item_id, | ||
| } | ||
| if test_run.session.itr_correlation_id and test_run.session.itr_skipping_level == ITRSkippingLevel.TEST: |
There was a problem hiding this comment.
Include the ID on suite-mode test skips
When suite-skipping is active and a skippable file contains the datadog_itr_unskippable marker, _pytest_ignore_collect_impl falls back to normal collection, and _handle_itr still skips the other tests because their suite is in skippable_items. Those skipped records are serialized as test events while session.itr_skipping_level is SUITE, so this condition drops content.itr_correlation_id from the events that need it for skip details; include it for test events that are marked skipped by ITR, or avoid gating purely on the session level.
Useful? React with 👍 / 👎.
brettlangdon
left a comment
There was a problem hiding this comment.
release note probably could be shortened, but overall pretty good
There was a problem hiding this comment.
More details
The PR correctly adds ITR correlation ID to test/suite event content with proper conditional logic. The correlation ID is only added when present AND the skipping level matches the event type (TEST for test events, SUITE for suite events). All edge cases are covered by comprehensive tests: missing correlation IDs are omitted, correlation IDs at non-matching skipping levels are omitted, and other event fields are preserved. The refactoring inlines a helper function while maintaining identical behavior.
📊 Validated against 9 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit bad4f0d · What is Autotest? · Any feedback? Reach out in #autotest
Description
Adds the ITR correlation ID to the
content.itr_correlation_idfield forddtrace.testingcitestcycle test/suite events when ITR is enabled and the skippable endpoint returns a correlation ID.The correlation ID was already parsed from the skippable response and emitted in citestcycle metadata. This change also propagates it onto serialized event content, matching other tracers’ behavior where all test/suite events in an ITR-enabled session carry the session-wide correlation ID.
Testing
content.itr_correlation_idcontent.itr_correlation_idRisks
Low. The field is only added when a correlation ID was returned by the ITR skippable endpoint. Existing metadata emission is preserved.
Additional Notes
Aligned with JavaScript and Java tracer behavior.