-
Notifications
You must be signed in to change notification settings - Fork 1.2k
prometheus: validate exponential histogram scale range (#6779) #6822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
prometheus: validate exponential histogram scale range (#6779) #6822
Conversation
6f10f59
to
4c1e41b
Compare
cc @dashpole |
4c1e41b
to
95c4664
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6822 +/- ##
=======================================
+ Coverage 82.3% 82.4% +0.1%
=======================================
Files 263 263
Lines 24416 24472 +56
=======================================
+ Hits 20095 20184 +89
+ Misses 3939 3908 -31
+ Partials 382 380 -2
🚀 New features to boost your workflow:
|
332fca7
to
e058c03
Compare
Fixes open-telemetry#6779 Add scale validation for Prometheus exponential histograms to ensure compatibility with Prometheus native histogram format. Changes: - Validate scale is within Prometheus supported range [-4, 8] - Reject scales below -4 (log error and skip data point) - Downscale histograms with scale > 8 by re-aggregating buckets - Add comprehensive test coverage for scale validation and downscaling - Implement downscaling logic based on OpenTelemetry Collector Contrib The downscaling implementation merges buckets using bit-shifting to maintain accuracy while conforming to Prometheus limitations.
e058c03
to
764b9f2
Compare
Hey @MrAlias, I updated my PR based on your feedback. Now there is only 1 new commit, and its passing test cases. Let me know if there are any issues with the change, and thanks for the initial feedback |
Removed unnecessary logic for trimming leading and trailing zeros in the downscaleExponentialBucket function.
}) | ||
} | ||
|
||
func TestGaugeMetrics(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a couple of unrelated tests added here. Are you just trying to increase test coverage, or were these mistakenly copied from somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@highlyavailable, can you please respond?
Fixes #6779
Changes
addExponentialHistogramMetric
Testing
TestExponentialHistogramScaleValidation
to verify error handling doesn't break normal operation