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

Support RecordMinMax for histogram and exponential histogram aggregations

Open dashpole opened this issue 1 month ago • 3 comments

I wanted to set RecordMinMax=false to work around an issue we (GCP) have with how min and max are handled, but wasn't able to.

Describe the solution you'd like

Implement RecordMinMax for histogram and exponential histogram aggregations. See

  • https://opentelemetry.io/docs/specs/otel/metrics/sdk/#explicit-bucket-histogram-aggregation
  • https://opentelemetry.io/docs/specs/otel/metrics/sdk/#base2-exponential-bucket-histogram-aggregation

It seems like they weren't added initially because they were optional at the time: https://github.com/open-telemetry/opentelemetry-java/issues/3938#issuecomment-995811446. Based on the specs above, they seem to be required now.

Oddly, it seems like declarative config somehow has a related parameter? https://github.com/open-telemetry/opentelemetry-java/blob/44aa06007a00e0394269267c1259a05ec52047f3/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/DeclarativeConfigurationParseTest.java#L606. But I couldn't find it anywhere else. Either way, I assume this would be useful to support the full declarative configuration spec.

dashpole avatar Nov 19 '25 20:11 dashpole

I assume you'd like to turn off the behavior where they're being recorded, since they appear to always be being recorded today?

jkwatson avatar Nov 19 '25 20:11 jkwatson

Yes, thats correct

dashpole avatar Nov 19 '25 20:11 dashpole

It seems like they weren't added initially because they were optional at the time: https://github.com/open-telemetry/opentelemetry-java/issues/3938#issuecomment-995811446. Based on the specs above, they seem to be required now.

Nah its been on my list forever. Just never did it because I hadn't heard anyone ask for it.

Declarative config has a parameter because it's schema mirrors the spec, and the parameter shows up in the spec. It wouldn't be fair / right for me to let opentelemetry-java limitations leak into the declarative config schema.

This is something we should do.

jack-berg avatar Nov 19 '25 22:11 jack-berg