beyla
beyla copied to clipboard
Expiring OTel histogram metrics
As discussed during the community call today, the opentelemetry expiry only handles counters, and not histograms: https://github.com/grafana/beyla/blob/main/pkg/internal/netolly/export/otel/expirer.go#L54. This is because synchronous APIs in OTel do not have delete methods on synchronous instruments: https://github.com/open-telemetry/opentelemetry-specification/issues/3062.
The workaround you can use for OTel is to use the SDK's Producer interface to provide aggregated histogram metric data. Alternatively, you could implement the Prometheus Collector interface (which would also solve this for the Prometheus export, and then use the prometheus bridge (go.opentelemetry.io/contrib/bridges/prometheus, which implements the Producer interface, to plug the histogram into the OTel SDK.