Skip to content
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

StackdriverMeterRegistry negative bucketCounts value #1325

Closed
robertalpha opened this issue Mar 26, 2019 · 1 comment
Closed

StackdriverMeterRegistry negative bucketCounts value #1325

robertalpha opened this issue Mar 26, 2019 · 1 comment
Labels
bug A general bug registry: stackdriver A StackDriver Registry related issue
Milestone

Comments

@robertalpha
Copy link

Occasionally these types of errors are logged:
i.m.s.StackdriverMeterRegistry - failed to send metrics to stackdriver: INVALID_ARGUMENT: Field timeSeries[13].points[0].distributionValue had an invalid value: Distribution bucket_counts(26) has a negative count.

I tracked it down to this line in the StackdriverMeterRegistry class:
// add the "+infinity" bucket, which does NOT have a corresponding bucket boundary bucketCounts.add(snapshot.count() - truncatedSum.get());
Sometimes the snapshot.count() method returns 0, while bucketCounts may contain positive values resulting in a negative bucket size at the end of the bucketCounts list. I think this is a bug in the code creating the snapshots, but locally I made a workaround to ensure non-negative values:
bucketCounts.add(Math.max(snapshot.count(), truncatedSum.get()) - truncatedSum.get());

@shakuzen
Copy link
Member

This is a side effect of #998.

@shakuzen shakuzen added the registry: stackdriver A StackDriver Registry related issue label Mar 27, 2019
shakuzen pushed a commit to ramondebeijer/micrometer that referenced this issue Dec 13, 2019
- bugfix for micrometer-metrics#1325
- filter out metric labels that are too long
ramondebeijer pushed a commit to ramondebeijer/micrometer that referenced this issue Dec 13, 2019
@shakuzen shakuzen added the bug A general bug label Mar 16, 2020
@shakuzen shakuzen added this to the 1.1.11 milestone Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug registry: stackdriver A StackDriver Registry related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants