Repository navigation
Conversation
Pull request dashboard statusWaiting on maintainers · refreshed 2026-10-23 20:22 UTC Merge when ready. Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9248 +/- ##
======================================
Coverage 89.4% 89.4%
======================================
Files 345 346 +1
Lines 22687 22886 +199
======================================
+ Hits 20289 20481 +192
- Misses 2398 2405 +7
🚀 New features to boost your workflow:
|
dashpole
marked this pull request as ready for review
October 20, 2026 20:03
dashpole
requested review from
MrAlias,
XSAM,
dmathieu,
flc1125,
pellared and
ps-mir
as code owners
October 20, 2026 20:03
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Both attribute translation helpers introduce quadratic collision-detection work for larger attribute sets.
1 open issue
What changed in this PR
Reduces per-scrape allocations in the Prometheus exporter’s attribute and histogram translation.
Changes:
- Reuses or pre-sizes label slices and allocates collision storage only when needed.
- Pre-sizes histogram bucket and exemplar label maps.
- Adds sanitized-label collision tests.
| File | Description |
|---|---|
| exporters/prometheus/exporter.go | Optimizes attribute translation and collection allocations. |
| exporters/prometheus/exporter_test.go | Tests data-point and scope label collisions. |
Review effort: Balanced
dmathieu
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Reduce per-scrape allocations when translating data point and instrumentation scope attributes in
exporters/prometheus:keysMap := make(map[string][]string)and per-attribute[]string{kv.Value.String()}allocations ingetAttrsandgetScopeAttrswith direct slice appends inattrs.Iter()order, allocating a collision map (dups map[int][]string) only when sanitized label names collide.getAttrsWithKVandappendScopeAttrsso data pointkeys/valuesslices are pre-sized toattrs.Len() + len(kv.keys)(or reusekv.keys/kv.valsdirectly whenattrs.Len() == 0) and scope attributes are appended directly intokv.positiveBucketsandnegativeBucketsinaddExponentialHistogramMetricandlabelsinattributesToLabels.Benchmark Output