Skip to content

fix(util): decode OTLP header values - #55004

Closed
sdivyanshu90 wants to merge 1 commit into
anomalyco:devfrom
sdivyanshu90:decode-otlp-headers
Closed

sdivyanshu90 wants to merge 1 commit into
anomalyco:devfrom
sdivyanshu90:decode-otlp-headers

Conversation

@sdivyanshu90

@sdivyanshu90 sdivyanshu90 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #55002

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

OTLP collectors currently receive Bearer%20test-token instead of Bearer test-token. Decode header values after splitting entries, preserving raw equals signs in values. Invalid percent encoding skips the affected entry without crashing exporter setup.

How did you verify your code works?

From packages/util, using Bun 1.4.2:

  • bun test test/observability-otlp.test.ts: 3 passed, 0 failed. Loopback requests exercise both real exporters, encoded spaces/comma/equals/percent/plus, raw equals signs, and malformed encoding. Both decoding regressions fail before the fix.
  • bun typecheck: passed.
  • Prettier and diff whitespace checks: passed.

The broader util suite initially hit an intermittent failure in the unchanged network-retry test; all five retry tests passed when run alone.

Screenshots / recordings

Not applicable; no rendered UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #22201

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@sdivyanshu90

Copy link
Copy Markdown
Contributor Author

Hi @kitlangton @rekram1-node, could you please review this PR whenever you have some time. Thanks!

@opencode-agent opencode-agent Bot left a comment

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.

Verified: the fix works. I ran the #55002 reproduction from source against a local collector. On the base, both /v1/logs and /v1/traces received Bearer%20test-token / one%2Ctwo. With this PR they receive Bearer test-token / one,two. bun test test/observability-otlp.test.ts passes (3/3), the two new tests fail on the base, and bun run typecheck in packages/util passes.

Public API: no API, config or flag changes. OTEL_EXPORTER_OTLP_HEADERS values are now percent-decoded as the OTLP spec requires. A value with a bare % that worked by accident before is now dropped, the same as OpenTelemetry's own parser does.

No blocking concerns.

Related: #22201

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V2 OTLP exporters send percent-encoded header values unchanged

1 participant