Skip to content

Truncate CI Visibility meta tag values#11485

Open
juan-fernandez wants to merge 2 commits into
masterfrom
juan-fernandez/truncate-ci-visibility-meta-tags
Open

Truncate CI Visibility meta tag values#11485
juan-fernandez wants to merge 2 commits into
masterfrom
juan-fernandez/truncate-ci-visibility-meta-tags

Conversation

@juan-fernandez
Copy link
Copy Markdown
Contributor

@juan-fernandez juan-fernandez commented May 28, 2026

What Does This Do

Truncates CI Visibility metadata/tag string values to 5000 characters before msgpack encoding and file-based intake dispatch.

Motivation

The backend maximum allowed tag value size is 5000 characters. Truncating in the tracer prevents oversized metadata values from being sent in CI Visibility payloads.

Additional Notes

Non-string metadata values are preserved as-is. Added unit coverage for both the CI test-cycle mapper path and file-based payload dispatcher path.

test-environment-trigger: skip

Contributor Checklist

Jira ticket: N/A

Validation:

  • git diff --check

The Java test task was not run locally because this machine does not currently have a Java runtime available.

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

datadog-prod-us1-4 Bot commented May 28, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

Check pull requests | Check pull requests   View in Datadog   GitHub Actions

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. Pull request validation failed: missing required labels for type and component or instrumentation.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 37b510b | Docs | Datadog PR Page | Give us feedback!

@juan-fernandez juan-fernandez marked this pull request as ready for review June 1, 2026 09:01
@juan-fernandez juan-fernandez requested review from a team as code owners June 1, 2026 09:01
@juan-fernandez juan-fernandez requested a review from mcculls June 1, 2026 09:01
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 1, 2026

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

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: b200a6d0b5

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

/* 2,1,1 */
headerWriter.writeUTF8(ENV);
headerWriter.writeUTF8(wellKnownTags.getEnv());
headerWriter.writeUTF8(truncate(wellKnownTags.getEnv()));
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 Convert well-known tags before truncating

In this header path, CiVisibilityWellKnownTags#getEnv() and the following well-known tag getters return UTF8BytesString, but the new truncate helper only accepts String. Java has to resolve truncate(...) before it can call writeUTF8, so this makes dd-trace-core fail to compile for the CI test-cycle mapper; convert these values to strings first or make the helper accept CharSequence.

Useful? React with 👍 / 👎.

assert spanContent.containsKey("parent_id")
}

def "truncates meta string values and preserves metrics and top level ids"() {
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 Migrate the new mapper tests to JUnit 5

This adds new Spock/Groovy coverage in a file under /workspace/dd-trace-java, but the repository instructions in /workspace/dd-trace-java/AGENTS.md explicitly say not to write new Groovy/Spock tests and to migrate existing Groovy tests to JUnit 5. Please move this new coverage to a JUnit 5 Java test instead of expanding the Spock suite.

Useful? React with 👍 / 👎.

/* 2,1,1 */
headerWriter.writeUTF8(ENV);
headerWriter.writeUTF8(wellKnownTags.getEnv());
headerWriter.writeUTF8(truncate(wellKnownTags.getEnv()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For well-known tags that will never change I'd recommend creating your own CI-Vis holder class containing truncated well-known tags. That would be more efficient and could also help address the comment above, because you could ensure that any truncated well-known tag values stay as the more efficient UTF8BytesString for marshalling purposes.

I'd also suggest looking at the existing Strings utility class that has truncate methods for String and CharSequence. You could add a similar truncate utility method that accepts UTF8BytesString and returns a UTF8BytesString.

@daniel-mohedano daniel-mohedano added comp: ci visibility Continuous Integration Visibility type: enhancement Enhancements and improvements labels Jun 1, 2026
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