Skip to content
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

Sync upstream Prometheus at 5303e51 #827

Merged
merged 2 commits into from
Feb 18, 2025
Merged

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Feb 18, 2025

This PR steps us closer to being in sync with the latest upstream changes.

This PR only includes the changes from prometheus/prometheus#15165, which had a number of merge conflicts.

I believe the PR above is safe to use as-is given the functionality is disabled by default.

sh0rez and others added 2 commits January 14, 2025 11:33
What

Adds support for OTLP delta temporality to the OTLP endpoint.
This is done by calling the deltatocumulative processor from the OpenTelemetry collector during OTLP conversion.

Why

Delta conversion is a naturally stateful process, which requires careful request routing when operated inside a collector.
Prometheus is already stateful and doing the conversion in-server reduces the operational burden on the ingest architecture by only having one stateful component.

How

deltatocumulative is a OTel collector component that works as follows:

* pmetric.Metrics come from a receiver or in this case from the HTTP client
* It operates as an in-place update loop:
    * for each sample, if not delta, leave unmodified
    * if delta, do:
      * state += sample, where state is the in-memory sum of all previous samples
      * sample = state, sample value is now cumulative
    * this is supported for sums (counters), gauges, histograms (old histograms) and exponential histograms (native histograms)
If a series receives no new samples for 5m, its state is removed from memory


Performance

Delta performance is a stateful operation and the OTel code is not highly optimized yet, e.g. it locks the entire processor for each request. Nonetheless, care has been taken to mitigate those effects:

delta conversion is behind a feature flag. If disabled, no conversion code is ever invoked
if enabled, conversion is not invoked if request not actually contains delta samples. This leads to no measureable performance difference between default-cumulative to convert-cumulative (only cumulative, feature on/off)

Signed-off-by: sh0rez <[email protected]>
# Conflicts:
#	storage/remote/write_handler.go
#	storage/remote/write_test.go
#	web/api/v1/api.go
#	web/api/v1/errors_test.go
@charleskorn charleskorn marked this pull request as ready for review February 18, 2025 04:12
@charleskorn charleskorn merged commit e4993f1 into main Feb 18, 2025
8 checks passed
@charleskorn charleskorn deleted the charleskorn/update-prometheus branch February 18, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants