open-telemetry / oteps

OpenTelemetry Enhancement Proposals
https://opentelemetry.io
Apache License 2.0
337 stars 164 forks source link

Proposal: specify how opentelemetry will deal with idle metrics no longer being reported #198

Open howardyoo opened 2 years ago

howardyoo commented 2 years ago

I've been testing opentelemetry SDK (python) to report counters, gauges to OTEL collector, and found out that when using PeriodicExportingMetricReader to periodically report the collected measurements, even though there is no values actually being reported from the observable gauges, the counters and gauges will keep reporting the last reported values (probably occurring within the reader itself?)

There are a couple of problems associated with this sort of behavior.

Therefore, we may need some clear definition of how long we will keep the idle metrics (which stopped reporting regularly from the sources) to eventually disappear from the reader's metrics storage. As far as I'm aware, it doesn't look like there is any mention of this concept yet in opentelemetry metrics.

A good example is how statsd lets user configure such behavior in its configuration: https://github.com/statsd/statsd/blob/master/exampleConfig.js?MobileOptOut=1#L61

I hope this issue ticket would steer the development of opentelemetry into a better direction forward.