-
Notifications
You must be signed in to change notification settings - Fork 833
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
feat(histogram): align collection of optional Histogram
properties with spec
#3102
feat(histogram): align collection of optional Histogram
properties with spec
#3102
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3102 +/- ##
==========================================
- Coverage 93.08% 92.10% -0.98%
==========================================
Files 188 181 -7
Lines 6244 5778 -466
Branches 1313 1228 -85
==========================================
- Hits 5812 5322 -490
- Misses 432 456 +24
|
dba2bfe
to
6246c3c
Compare
@@ -261,7 +261,7 @@ export class PrometheusSerializer { | |||
results += stringify( | |||
name + '_' + key, | |||
attributes, | |||
value[key], | |||
value[key] ?? 0, |
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'd find coalescing the sum value to 0 can be confusing. Would it be possible to not output this value?
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 also though it was weird, I did that as this seems to be the behavior of the exporter in collector-contrib. Not outputting the value sounds like the better approach, I adopted the idea in 695aeb8. 🙂
I'll also open an issue in collector contrib to see what people there think. 🙂
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.
Opened a discussion on collector-contrib here: open-telemetry/opentelemetry-collector-contrib#12646 🙂
Which problem is this PR solving?
With a Histogram Aggregation,
sum
was collected even when using it with instruments likeUpDownCounter
orObservableGauge
, which allow negative measurements. However, the specification states this:This PR changes the Aggregation so that
sum
is only exported when used with instruments that only allow non-negative values. With the previous approach this would be indicated with a flag. This approach became unwieldy, so instead the type forsum
is changed tonumber | undefined
. To prevent a mix of approaches for the same problem,min
andmax
's types are also changed tonumber | undefined
and thehasMinMax
field is dropped.Fixes #3090
Short description of the changes
Histogram
type's fieldssum
,min
andmax
to be of typenumber | undefined
hasMinMax
field from theHistogram
type.sum = 0
).Type of change
Please delete options that are not relevant.
sum
is now optional onHistogram
and might beundefined
min
andmax
are now optional onHistogram
and might beundefined
hasMinMax
has been removed onHistogram
How Has This Been Tested?
Checklist: