GoogleCloudPlatform / opentelemetry-operations-go

Apache License 2.0
127 stars 99 forks source link

There is an upper bound of number of Exponential Buckets that can be easily exceeded #779

Closed franciscovalentecastro closed 6 months ago

franciscovalentecastro commented 6 months ago

While working on https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/777 found that there is an upper bound of number of exponential buckets that can be easily exceeded when exporting an Exponential Histogram.

rpc error: code = InvalidArgument desc = One or more TimeSeries could not be written: Field timeSeries[3].points[0].value had an invalid value: Distribution metric has too many buckets.
dashpole commented 6 months ago

I assume this is a bug with the current collector implementation. In that case, we would need to merge buckets (scale down, I think?) to get below the upper bound.

franciscovalentecastro commented 6 months ago

After debugging further found that the way i was translating between the OTel ExponetialHistogram to Cloud Monitoring Distribution was adding a lot unneeded (empty) buckets to account for the Offset parameter. By adding Offset correctly encoded inside the scale parameter ( base ** Offset) this shouldn't happen anymore, since the MaxSize number of buckets is 160.

Closing this one since it was a bug in the translation.