estimated_histogram: also fill up sum metric
estimated_histogram: also fill up sum metric

Prometheus histograms have 3 embedded metrics: count, buckets, and sum.
Currently we fill up count and buckets but sum is left at 0. This is
particularly bad, since according to the prometheus documentation, the
best way to calculate histogram averages is to write:

  rate(metric_sum[5m]) / rate(metric_count[5m])

One way of keeping track of the sum is adding the value we sampled,
every time we sample. However, the interface for the estimated histogram
has a method that allows to add a metric while allowing to adjust the
count for missing metrics (add_nano())

That makes acumulating a sum inaccurate--as we will have no values for
the points that were added. To overcome that, when we call add_nano(),
we pretend we are introducing new_count - _count metrics, all with the
same value.

Long term, doing away with sampling may help us provide more accurate
results.

After this patch, we are able to correctly calculate latency averages
through the data exported in prometheus.

Signed-off-by: Glauber Costa <7ba9037b0dd006f9408bd45b94707becd5cd4e87@scylladb.com>
Message-Id: <20171122144558.7575-1-7ba9037b0dd006f9408bd45b94707becd5cd4e87@scylladb.com>

scylladb/scylla,scylladb/scylla,avikivity/scylla,scylladb/scylla,duarten/scylla,duarten/scylla,scylladb/scylla,avikivity/scylla,avikivity/scylla,duarten/scylla