Package com.codahale.metrics

Examples of com.codahale.metrics.Snapshot


      LOGGER.warn("Unable to report to InfluxDB. Discarding data.", e);
    }
  }

  private void reportTimer(String name, Timer timer, long timestamp) {
    final Snapshot snapshot = timer.getSnapshot();
    Object[] p = pointsTimer[0];
    p[0] = timestamp;
    p[1] = snapshot.size();
    p[2] = convertDuration(snapshot.getMin());
    p[3] = convertDuration(snapshot.getMax());
    p[4] = convertDuration(snapshot.getMean());
    p[5] = convertDuration(snapshot.getStdDev());
    p[6] = convertDuration(snapshot.getMedian());
    p[7] = convertDuration(snapshot.get75thPercentile());
    p[8] = convertDuration(snapshot.get95thPercentile());
    p[9] = convertDuration(snapshot.get99thPercentile());
    p[10] = convertDuration(snapshot.get999thPercentile());
    p[11] = convertRate(timer.getOneMinuteRate());
    p[12] = convertRate(timer.getFiveMinuteRate());
    p[13] = convertRate(timer.getFifteenMinuteRate());
    p[14] = convertRate(timer.getMeanRate());
    assert (p.length == COLUMNS_TIMER.length);
View Full Code Here


    assert (p.length == COLUMNS_TIMER.length);
    influxdb.appendSeries(prefix, name, ".timer", COLUMNS_TIMER, pointsTimer);
  }

  private void reportHistogram(String name, Histogram histogram, long timestamp) {
    final Snapshot snapshot = histogram.getSnapshot();
    Object[] p = pointsHistogram[0];
    p[0] = timestamp;
    p[1] = snapshot.size();
    p[2] = snapshot.getMin();
    p[3] = snapshot.getMax();
    p[4] = snapshot.getMean();
    p[5] = snapshot.getStdDev();
    p[6] = snapshot.getMedian();
    p[7] = snapshot.get75thPercentile();
    p[8] = snapshot.get95thPercentile();
    p[9] = snapshot.get99thPercentile();
    p[10] = snapshot.get999thPercentile();
    assert (p.length == COLUMNS_HISTOGRAM.length);
    influxdb.appendSeries(prefix, name, ".histogram", COLUMNS_HISTOGRAM, pointsHistogram);
  }
View Full Code Here

    /**
     * @param rescale the submitted sum by this multiplier. 1.0 is the identity (no rescale).
     */
    private void sampling(DemuxedKey key, Sampling metric, double rescale, String type, Collection<MetricDatum> data) {
        Snapshot snapshot = metric.getSnapshot();
        data.add(key.newDatum(type).withStatisticValues(new StatisticSet()
                .withSum(sum(snapshot.getValues()) * rescale)
                .withSampleCount((double) snapshot.size())
                .withMinimum((double) snapshot.getMin())
                .withMaximum((double) snapshot.getMax())));
    }
View Full Code Here

        final Map<String, Number> ret = new HashMap<String, Number>();

        for (Map.Entry<String, Timer> entry : registry.getTimers().entrySet()) {
            String prefix = entry.getKey() + "/";
            Timer timer = entry.getValue();
            Snapshot snapshot = timer.getSnapshot();

            ret.put(prefix + "count", timer.getCount());
            ret.put(prefix + "max", snapshot.getMax());
            ret.put(prefix + "mean", snapshot.getMean());
            ret.put(prefix + "min", snapshot.getMin());
            ret.put(prefix + "stddev", snapshot.getStdDev());
            ret.put(prefix + "p50", snapshot.getMedian());
            ret.put(prefix + "p75", snapshot.get75thPercentile());
            ret.put(prefix + "p95", snapshot.get95thPercentile());
            ret.put(prefix + "p98", snapshot.get98thPercentile());
            ret.put(prefix + "p99", snapshot.get99thPercentile());
            ret.put(prefix + "p999", snapshot.get999thPercentile());
            ret.put(prefix + "mean_rate", timer.getMeanRate());
            ret.put(prefix + "m1_rate", timer.getOneMinuteRate());
            ret.put(prefix + "m5_rate", timer.getFiveMinuteRate());
            ret.put(prefix + "m15_rate", timer.getFifteenMinuteRate());
        }
View Full Code Here

        for (Map.Entry<String, Histogram> entry : registry.getHistograms()
                .entrySet()) {
            String prefix = entry.getKey() + "/";
            Histogram histogram = entry.getValue();
            Snapshot snapshot = histogram.getSnapshot();

            ret.put(prefix + "count", histogram.getCount());
            ret.put(prefix + "max", snapshot.getMax());
            ret.put(prefix + "min", snapshot.getMin());
            ret.put(prefix + "stddev", snapshot.getStdDev());
            ret.put(prefix + "p50", snapshot.getMedian());
            ret.put(prefix + "p75", snapshot.get75thPercentile());
            ret.put(prefix + "p95", snapshot.get95thPercentile());
            ret.put(prefix + "p98", snapshot.get98thPercentile());
            ret.put(prefix + "p99", snapshot.get99thPercentile());
            ret.put(prefix + "p999", snapshot.get999thPercentile());

        }
        return ret;
    }
View Full Code Here

      for (final FastWorker w : workers) {
         histogram.update(w.iterations);
      }
     
      final Logger logger = LoggerFactory.getLogger(getClass());
      final Snapshot snapshot = histogram.getSnapshot();
      logger.info("Min: {}, Max: {}. Median: {}", snapshot.getMin(), snapshot.getMax(), (int) snapshot.getMedian());
      logger.info("75%: {}, 95%: {}, 99%: {}", (int) snapshot.get75thPercentile(), (int)snapshot.get95thPercentile(), (int)snapshot.get99thPercentile());
   }
View Full Code Here

    /**
     * @param rescale the submitted sum by this multiplier. 1.0 is the identity (no rescale).
     */
    void reportSampling(Map.Entry<String, ? extends Sampling> entry, String type, double rescale, List<MetricDatum> data) {
        Sampling metric = entry.getValue();
        Snapshot snapshot = metric.getSnapshot();
        double scaledSum = sum(snapshot.getValues()) * rescale;
        final StatisticSet statisticSet = new StatisticSet()
                .withSum(scaledSum)
                .withSampleCount((double) snapshot.size())
                .withMinimum((double) snapshot.getMin())
                .withMaximum((double) snapshot.getMax());

        DemuxedKey key = new DemuxedKey(entry.getKey());
        Iterables.addAll(data, key.newDatums(type, new Function<MetricDatum, MetricDatum>() {
            @Override
            public MetricDatum apply(MetricDatum datum) {
View Full Code Here

        min.update(-value);
    }

    @Override
    public Snapshot getSnapshot() {
        return new Snapshot(new long[0]) {
            private final long num = SimpleReservoir.this.num.sumThenReset();
            private final long sum = SimpleReservoir.this.sum.sumThenReset();
            private final long max = SimpleReservoir.this.max.maxThenReset();
            private final long min = SimpleReservoir.this.min.maxThenReset();
View Full Code Here

        min.accumulate(value);
    }

    @Override
    public Snapshot getSnapshot() {
        return new Snapshot(new long[0]) {
            private final long num = SimpleReservoir.this.num.sumThenReset();
            private final long sum = SimpleReservoir.this.sum.sumThenReset();
            private final long max = SimpleReservoir.this.max.getThenReset();
            private final long min = SimpleReservoir.this.min.getThenReset();
View Full Code Here

        min.update(-value);
    }

    @Override
    public Snapshot getSnapshot() {
        return new Snapshot(new long[0]) {
            private final long num = SimpleReservoir.this.num.sumThenReset();
            private final long sum = SimpleReservoir.this.sum.sumThenReset();
            private final long max = SimpleReservoir.this.max.maxThenReset();
            private final long min = SimpleReservoir.this.min.maxThenReset();
View Full Code Here

TOP

Related Classes of com.codahale.metrics.Snapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.