open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.12k stars 2.39k forks source link

receiver/promettheusreceiver: add option to the metric adjuster to fallback to collector start time #36364

Open ridwanmsharif opened 1 week ago

ridwanmsharif commented 1 week ago

Component(s)

receiver/prometheusreceiver

Is your feature request related to a problem? Please describe.

When scraping prometheus metrics, there often are no start times associated with the cumulative metrics. There is a metric adjuster that allows the configurer to specify another metric name from which to pull start time for all metrics scraped but I believe its useful to have a fallback mechanism to fall back to the collector start time.

This is useful especially in serverless workloads or workloads where the collector runs as a sidecar to the target being scraped. We currently use this approach for Cloud Run observability in https://github.com/GoogleCloudPlatform/run-gmp-sidecar/ and its been very useful there.

Describe the solution you'd like

An option added to the config, something like UseCollectorStartTimeFallback

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 1 week ago

Pinging code owners for receiver/prometheus: @Aneurysm9 @dashpole. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

dashpole commented 1 week ago

cc @ArthurSens