Description
Component(s)
processor/metricstarttime
Is your feature request related to a problem? Please describe.
This is part of implementing the metricstarttime processor. This strategy is useful because is preserves semantics for cumulative metrics, meaning that the cumulative value between the start and end time is from observations that occured in that window.
Describe the solution you'd like
- For each resource, and for each timeseries
- Skip if the point is not a cumulative sum, histogram, exp histogram, or summary, or if it already has a start timestamp.
- Lookup the timeseries in the cache. If it is not present, drop this point from the batch, and store the timestamp and value (including bucket counts, etc) in the cache.
- Subtract cumulative values (e.g. sum, bucket counts) of the cached timeseries from the current timeseries, and set the start timestamp to the cached point's timestamp.
- Drop any points where the start timestamp is after the timestamp.
Describe alternatives you've considered
No response
Additional context
This is similar to what is done in the google exporters: https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/main/exporter/collector/internal/normalization/standard_normalizer.go