#ifndef SLED_METRIC_HISTOGRAMH
#define SLED_METRIC_HISTOGRAMH

#pragma once

#include "counter.h"
#include "sled/synchronization/mutex.h"
#include <vector>

namespace sled {
namespace metric {
class Histogram {
public:
    using BucketBoundaries = std::vector<double>;

    explicit Histogram(const BucketBoundaries &bucket_boundaries);
    explicit Histogram(BucketBoundaries &&bucket_boundaries);

    void Observe(double value);
    void ObserveMutiple(const std::vector<double> &bucket_increments, double sum_of_values);
    void Reset();

private:
    mutable Mutex mutex_;
    BucketBoundaries bucket_boundaries_;
    std::vector<Counter> bucket_counts_;
    Gauge sum_;
};
}// namespace metric
}// namespace sled

#endif// SLED_METRIC_HISTOGRAMH
