opentelemetry-specification icon indicating copy to clipboard operation
opentelemetry-specification copied to clipboard

Are buckets optional in OTLP Exponential Histograms?

Open mx-psi opened this issue 6 months ago • 3 comments

What are you trying to achieve?

As a vendor consuming OTLP data, we want to understand what kind of OTLP Exponential Histograms are aligned with the specification.

What did you expect to see?

OTLP Histogram buckets are optional according to the latest specification. The proto definition for OTLP Exponential Histograms allows sending an exponential histogram without buckets, but this is not explicitly mentioned in the data model document.

I would like the data model to explicitly mention if buckets are optional for exponential histograms.

mx-psi avatar Jan 29 '24 13:01 mx-psi

I think as a vendor you should be prepared to accept exponential histograms without buckets. Consider negative buckets: these are only possible to produce outside of an SDK, since the metrics histogram API / SDK currently does not accept negative values. I would expect that some SDK implementations omit the negative bucket field rather than include an empty version

With that said, the java implementation does serialize an empty value for the negative buckets, rather than omitting it.

jack-berg avatar Jan 29 '24 16:01 jack-berg

I think we should clarify this in the specification.

Given we're moving from Explicit Bucket => Exponential histograms, we think it is reasonable that users would ALSO be able to configure Exponential histograms with 0 buckets the way they do Explicit buckets today. In this case the user is looking for a "cheaper" summary of min/max/count/sum.

Specifically, if we look at the specification for configuring these, we do allow user to set MaxSize to 0.

jsuereth avatar Feb 07 '24 15:02 jsuereth

Specifically, if we look at the specification for configuring these, we do allow user to set MaxSize to 0.

Where do you see that? We actually just recently fixed a bug in java which was caused by setting the number of buckets to 1: https://github.com/open-telemetry/opentelemetry-java/issues/6089.

We might consider clarifying the spec to say that exponential buckets MaxSize is > 1, and that you a single bucket explicit bucket histogram is the mechanism you should use for producing a summary (min, max, count, sum).

jack-berg avatar Feb 07 '24 16:02 jack-berg