Visitar URL original
Cache UTF-8 encoded OTLP metric metadata by JoeCqupt · Pull Request #9033 · open-telemetry/opentelemetry-java · GitHub
Skip to content

Cache UTF-8 encoded OTLP metric metadata - #9033

Open
JoeCqupt wants to merge 1 commit into
open-telemetry:mainfrom
JoeCqupt:feat/otlp-metrics-utf8-cache
Open

JoeCqupt wants to merge 1 commit into
open-telemetry:mainfrom
JoeCqupt:feat/otlp-metrics-utf8-cache

Conversation

@JoeCqupt

Copy link
Copy Markdown

MetricMarshaler currently re-encodes metric names, descriptions, and units on every export, allocating new byte arrays for non-empty strings even when the metadata is unchanged.

Cache these encodings using the existing WeakConcurrentMap implementation. Repeated use of the same string objects reuses their encoded bytes. Weak keys allow unused metadata to be collected, and subsequent cache accesses remove stale entries.

Add a focused test verifying that separate marshaler instances reuse the same byte arrays for the name, description, and unit.

@JoeCqupt
JoeCqupt requested a review from a team as a code owner November 13, 2026 08:20
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-11-13 08:46 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.44%. Comparing base (b11bb9c) to head (1ba88c3).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9033   +/-   ##
=========================================
  Coverage     90.44%   90.44%           
- Complexity    11171    11175    +4     
=========================================
  Files          1032     1032           
  Lines         30451    30459    +8     
  Branches       3974     3975    +1     
=========================================
+ Hits          27540    27548    +8     
  Misses         1935     1935           
  Partials        976      976           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant