opentelemetry-erlang
opentelemetry-erlang copied to clipboard
Metrics: remove active instruments that haven't had recent recordings
Each active instrument (the combination of an instrument name and a labelset) is stored in the active instruments ets table. There is no reason to keep these active instrument rows if they are not actively being used.
The active_instrument
needs to change to include a counter for how many collection cycles this record has not had an update. After a certain threshold the row is removed from the table.
This is detailed in the SDK spec https://github.com/open-telemetry/opentelemetry-specification/blob/2b75442b05fd968f197422dc18124338a955f3a2/specification/sdk-metric.md#recommended-implementation
Additional context about active instruments and collection cycles https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/metrics/sdk.md#accumulator-collect-function