Skip to content

Conversation

@greyireland
Copy link

No description provided.

Giulio2002 pushed a commit to erigontech/erigon that referenced this pull request May 11, 2023
this pr is ready for review, but it is waiting on this PR 

VictoriaMetrics/metrics#45

so that we do not need to use a replace directive.
@clementnuss
Copy link
Contributor

any news here ? what can be done to help get this PR merged ?

@hagen1778
Copy link
Contributor

hagen1778 commented May 23, 2023

Hello @greyireland @clementnuss!
I don't think it is a good idea to convert VictoriaMetrics histograms in Prometheus histograms because the former histograms are sparse with dynamic buckets. While standard Prometheus histograms are static and the whole logic for processing Prometheus histograms relies on that logic. For example, if instance A will produce 10 buckets for query latency histogram, and instance B will produce 11 buckets - the aggregation of 99th latency percentile for instance A and B will be calculated incorrectly.
So in fact, this change will result into confusion and incorrect processing results. Prometheus standard histograms should have static buckets across all application instances.

@neal
Copy link

neal commented Jun 13, 2023

@hagen1778 that's a good point and in that case it may make more sense to add Prometheus style static buckets based Histogram in order to be fully compatible.

@vtolstov
Copy link
Contributor

vtolstov commented Nov 8, 2024

@neal @greyireland do you plan to create fully prometheus compatible variant? my use-case - i don't like prometheus because it have many allocations with protobuf based structure creating, encoding...
but can't use vm metrics because on upper level i have only prometheus.
So i need fully compatible prometheus histogram support with predefined buckets across all services

@vtolstov
Copy link
Contributor

@valyala can you help? in this case this package can be used for k8s metrics exporting as prometheus client have huge memory usage

hagen1778 added a commit that referenced this pull request Jun 13, 2025
as a follow-up/alternative to #45 and to solve #28, I'm starting this PR
which adds support for [OTLP
histograms](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#histogram)
(the common `le` - static bucket type of histograms, not the complex
exponential histograms/native histograms).

I know that VM focus is on log based buckets and really appreciate
those, but having the opportunity to use "normal" histograms with this
library would be greatly appreciated, as documented in #28

before working too much on this, I'd like to know whether support for
normal / OTLP style buckets could be considered or not. I don't want to
spend too much time on this PR if at the end @valyala @hagen1778 you
decide against such a feature.

I'd also like to start a discussion on the name. I picked
`OTLPHistogram` in reference to the histograms described in the
OpenTelemetry Protocol, but perhaps the naming is bad.
[EDIT]: I think that `CompatibleHistogram` would make more sense than
`OTLPHistogram`, had not thought about it until after I started
implementing the functions


currently the basic functionality is implemented, and a testcase covers
a simple usage. if there is a decision in favor of this PR, I will add
the missing testcases and complete the implementation (add a function
for custom buckets/upper bounds for example)

---------

Co-authored-by: Roman Khavronenko <[email protected]>
Co-authored-by: hagen1778 <[email protected]>
@hagen1778
Copy link
Contributor

@vtolstov @neal @greyireland pull request #93 has been merged. Starting from v1.38.0 metrics package supports PrometheusHistogram metric type. See examples how to use it here https://github.com/VictoriaMetrics/metrics/blob/master/prometheus_histogram_example_test.go

Additionally, package exports ExponentialBuckets and LinearBuckets helpers for convenience of generating static buckets.

@hagen1778
Copy link
Contributor

Closing this PR in favour of #93.
Starting from v1.38.0 metrics package supports PrometheusHistogram metric type with le bucket labels.

@hagen1778 hagen1778 closed this Jun 16, 2025
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.

6 participants