# Functions
NewCounterCache initializes and returns a CounterCache.
PromHistogramToES takes a Prometheus histogram and converts it to an ES histogram:
ES histograms look like this:
"histogram_field" : { "values" : [0.1, 0.2, 0.3, 0.4, 0.5], "counts" : [3, 7, 23, 12, 6] }
This code takes a Prometheus histogram and tries to accomodate it into an ES histogram by: - calculating centroids for each bucket (values) - undoing counters accumulation for each bucket (counts)
https://www.elastic.co/guide/en/elasticsearch/reference/master/histogram.html.
# Interfaces
CounterCache keeps a cache of the last value of all given counters and allows to calculate their rate since the last call.