Skip to content

Implement propagation of custom tags to all test event levels#11366

Open
daniel-mohedano wants to merge 3 commits into
masterfrom
daniel.mohedano/all-events-custom-tags
Open

Implement propagation of custom tags to all test event levels#11366
daniel-mohedano wants to merge 3 commits into
masterfrom
daniel.mohedano/all-events-custom-tags

Conversation

@daniel-mohedano
Copy link
Copy Markdown
Contributor

@daniel-mohedano daniel-mohedano commented May 13, 2026

What Does This Do

  • Implements propagation of tags to all test event levels:
    • Users will be able to define an "allow-list" through DD_CIVISIBILITY_PROPAGATED_TAGS (e.g. DD_CIVISIBILITY_PROPAGATED_TAGS=custom.shard_index,custom.total_shards,build.id)
    • The configured tags will be propagated upwards to all levels: test -> suite -> module -> session
    • The current implementation merges values (if different) on propagation by overriding the current span's tag value

Motivation

These changes allow users to programmatically set custom tags at session and module level, which was previously not possible, by setting them at test (or suite) level.

Additional Notes

test-environment-trigger: skip

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@daniel-mohedano daniel-mohedano added type: enhancement Enhancements and improvements comp: ci visibility Continuous Integration Visibility labels May 14, 2026
@daniel-mohedano daniel-mohedano marked this pull request as ready for review May 14, 2026 12:31
@daniel-mohedano daniel-mohedano requested review from a team as code owners May 14, 2026 12:31
@daniel-mohedano daniel-mohedano requested review from manuel-alvarez-alvarez and sarahchen6 and removed request for a team May 14, 2026 12:32
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: 6fec4d9d65

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

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


// Mocks AgentSpan (interface) rather than DDSpan because propagateCustomTags writes through
// the final DDSpan#setTag(String, String) overload, which Spock cannot intercept on a class mock.
def "test custom tag propagation from span: child=#childValue, parent=#parentValue, key=#key, allowlist=#allowlist"() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move new Spock cases to JUnit 5

AGENTS.md for this repo says, “Do not write new Groovy / Spock tests and migrate the existing one to JUnit 5 if it is written in Groovy.” The new custom-tag propagation coverage added here extends a Spock spec, so this change violates the repository’s test convention; please move these cases to a JUnit 5 test or migrate the existing spec instead of adding more Spock coverage.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Although it's not a new test, we'll have to do the migration at some point, so migrated the test file to JUnit 5 in eca6ec9

Comment on lines +780 to +787
"DD_CIVISIBILITY_PROPAGATED_TAGS": [
{
"version": "A",
"type": "string",
"default": null,
"aliases": []
}
],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Waiting on updating the configuration registry until the PR is ready to be merged 🚀

@daniel-mohedano
Copy link
Copy Markdown
Contributor Author

daniel-mohedano commented May 14, 2026

Indeed, after some more testing they do seem to be handled differently, while still allowing some numerical-like operations even with the strings. Addressed in 3d5e279 to keep the typing of tags

Copy link
Copy Markdown
Contributor

@sarahchen6 sarahchen6 left a comment

Choose a reason for hiding this comment

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

Looks good from LP-side (after configs are updated)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: ci visibility Continuous Integration Visibility type: enhancement Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants