Cherry-pick #17061 to 7.x: Use Elasticsearch histogram type to store Prometheus histograms #17227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #17061 to 7.x branch. Original message:
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