-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[receiver/prometheus + processor/cumulativetodelta] Handling unknown start timestamps on cumulative streams #17190
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Pinging code owners for processor/cumulativetodelta: @TylerHelmuth. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Any updates @danielgblanco ? |
Thanks for the reminder @mx-psi . I've just tested the above steps with
As such, I'll close this ticket and consider it fixed 🎉 |
Component(s)
processor/cumulativetodelta, receiver/prometheus
What happened?
Description
When using a
prometheus
receiver to scrape targets that don't expose timestamps on metrics exported (e.g. another collector), the first scrape of a cumulative counter results in a data point with the sameStartTimestamp
andTimestamp
, and the current value of the counter. For example, a collector accepting 20 spans per minute would report the following metric after it has been running for a while (when the scraping collector restarts and does the first scrape):This is the intended behaviour if these metrics are exported with cumulative temporality and the exporter disregards the
StartTimestamp
(as it would be with other Prometheus exporters). However, when using it with acumulativetodelta
processor, and exporting OTLP data points with delta temporality, it seems to violate the advice in https://opentelemetry.io/docs/reference/specification/metrics/data-model/#cumulative-streams-handling-unknown-start-time.Clearly,
prometheus
receiver reporting a0
value here wouldn't be a good solution, because the second data point would have differentStartTimestamp
andTimestamp
and be treated as a true counter reset, and I don't believe it'd beprometheus
receiver responsibility to handle state and keep a "new" count of cumulative counters.I believe, according to spec, that it should be the
cumulativetodelta
processor responsibility to handle cases whereStartTimestamp
andTimestamp
are treat that as a "start" value, dropping the metric, while storing the value. Although, looking at the code, I'm unsure if theDeltaValue
here should be consideredvalid
(not sure in what cases the first value of a monotonic sum should be considered valid, I'd expect to have at least two values to calculate delta):opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor/internal/tracking/tracker.go
Line 100 in 4eaa9f8
And the assumption here that only non-cumulative values should not report the first value, does it consider the case in question?
opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor/processor.go
Line 176 in 4eaa9f8
Steps to Reproduce
Run a collector scraping another collector (controlling scrape port via
prometheus.io/scrape_port
annotation) which is receiving approximately 20 spans per minute. The collector scraping Prometheus metric using the config below must be restarted a while after the collector being scraped to clearly see the behaviour.Expected Result
The following metric data point reported with
Timestamp: 2022-12-21 13:34:32.866 +0000 UTC
and no data point reported withTimestamp: 2022-12-21 13:34:02.866 +0000 UTC
:Actual Result
The following data point being reported
Collector version
v0.67.0
Environment information
Environment
otel/opentelemetry-collector-contrib
Docker image running on Kubernetes v1.25.3OpenTelemetry Collector configuration
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: