@Override
  public Histogram histogram(String name) {
    return new FixedReservoirHistogram(DEFAULT_HISTOGRAM_RESERVOIR_SIZE);
  }
@Test
  public void histogram() {
    MetricsContext metricsContext = new DefaultMetricsContext();
    int reservoirSize = 1000;
    Histogram histogram = metricsContext.histogram("test");
    for (int i = 1; i <= reservoirSize; ++i) {
      histogram.update(i);
    }

    assertThat(histogram.count()).isEqualTo(reservoirSize);
    Histogram.Statistics statistics = histogram.statistics();
    assertThat(statistics.size()).isEqualTo(reservoirSize);
    assertThat(statistics.mean()).isEqualTo(500.5);
    assertThat(statistics.stdDev()).isCloseTo(288.67499, withinPercentage(0.001));
    assertThat(statistics.max()).isEqualTo(1000L);
    assertThat(statistics.min()).isEqualTo(1L);
    assertThat(statistics.percentile(0.50)).isEqualTo(500);
    assertThat(statistics.percentile(0.75)).isEqualTo(750);
    assertThat(statistics.percentile(0.90)).isEqualTo(900);
    assertThat(statistics.percentile(0.95)).isEqualTo(950);
    assertThat(statistics.percentile(0.99)).isEqualTo(990);
    assertThat(statistics.percentile(0.999)).isEqualTo(999);
  }