-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Use Elasticsearch histogram type to store Prometheus histograms #17061
Conversation
Pinging @elastic/integrations-platforms (Team:Platforms) |
) | ||
|
||
// promHistogramToES takes a Prometheus histogram and converts it to | ||
func promHistogramToES(cc CounterCache, name string, labels common.MapStr, histogram *dto.Histogram) common.MapStr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iverase FYI, I'm working on this now 🙂, in case you want to have a look
9f813f7
to
1be82a6
Compare
This is useful when we want to have different behaviors between flavours
This should make room for using different Elasticsearch types depending on the Prometheus metric
Co-Authored-By: Chris Mark <chrismarkou92@gmail.com>
41ddf1e
to
f05f1ce
Compare
58f42fe
to
78d1941
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It LGTM. I think we could use use the new implementation by default in openmetrics from the very beginning as we haven't released it yet, would it make sense?
Apart of that, some minor suggestions and nitpicking.
} | ||
|
||
func (g *typedGenerator) Start() { | ||
cfgwarn.Beta("Prometheus 'use_types' setting is beta") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need to be parameterized for openmetrics if used also there.
var counts []uint64 | ||
|
||
// calculate centroids and rated counts | ||
var lastUpper, prevUpper float64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Use prevLastUpper
or secondLastUpper
to know that it refers to the second last upper bound seen?
var lastUpper, prevUpper float64 | |
var lastUpper, prevLastUpper float64 |
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
b204a49
to
fff3faf
Compare
…tic#17061) * Allow to override already defined metricsets This is useful when we want to have different behaviors between flavours * Add new Prometheus skeleton for basic types usage * Refactor Prometheus module to accommodate newer uses * Add typed schema to Prometheus module This should make room for using different Elasticsearch types depending on the Prometheus metric * Convert Prometheus histograms to ES histograms Co-authored-by: Chris Mark <chrismarkou92@gmail.com> Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co> (cherry picked from commit 142b859)
…Prometheus histograms (#17227) * Use Elasticsearch histogram type to store Prometheus histograms (#17061) * Allow to override already defined metricsets This is useful when we want to have different behaviors between flavours * Add new Prometheus skeleton for basic types usage * Refactor Prometheus module to accommodate newer uses * Add typed schema to Prometheus module This should make room for using different Elasticsearch types depending on the Prometheus metric * Convert Prometheus histograms to ES histograms Co-authored-by: Chris Mark <chrismarkou92@gmail.com> Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co> (cherry picked from commit 142b859) * make update
What does this PR do?
Allow to store Prometheus histograms as Elasticsearch histograms when using the
collector
metricset. This change adds a newuse_types
feature flag to enable the new behavior. When enabled it will use a new schema for Prometheus metrics:prometheus.*.counter
prometheus.*.value
prometheus.*.histogram
Also, when using
rate_counters
, a newprometheus.*.rate
field will be created for all counter metrics. It stores the increment of the counter since the last fetch.For better results, it is recommended to use
tdigest.compression: 1
when calculating percentiles:A note on graph fidelity
This is a first stab at supporting Prometheus Histograms using Elasticsearch histograms. As algorithms and query semantics differ between these two projects, the resulting graphs are not exactly the same (while both are representing correct data).
We will keep working with the Elasticsearch team to provide better fidelity when compared to Prometheus way of graphing histograms. This will be a good start: elastic/elasticsearch#49452
Why is it important?
Histograms are a big part of Prometheus metrics, and being able to store and query them correctly is a great feature when dealing with these.
Checklist
How to test this PR locally
This feature requires Elasticsearch 7.6 or later. Also Kibana support is not yet merged into master, I'm testing this in combination with elastic/kibana#59387.
Related issues
Closes #14843