Package com.codahale.metrics

Examples of com.codahale.metrics.Snapshot


    /**
     * @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() * rescale)
                .withMaximum((double) snapshot.getMax() * rescale);

        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


    /**
     * @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

    /**
     * @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

      } else {
        value = JStormUtils.formatDoubleDecPoint4(value);
        gaugeData.put(name, value);
      }
      } else if (metric instanceof Timer) {
      Snapshot snapshot = ((Timer) metric).getSnapshot();
      //Covert from ns to ms
      Double value = JStormUtils.formatDoubleDecPoint4(
          (snapshot.getMean())/1000000);
      timerData.put(name, value);
    } else if (metric instanceof Counter) {
        Long value = ((Counter) metric).getCount();
        counterData.put(name, value.doubleValue());
    } else if (metric instanceof Meter) {
      Double value = JStormUtils.formatDoubleDecPoint4(
          ((Meter) metric).getMeanRate());
      meterData.put(name, value);
    } else if (metric instanceof Histogram) {
      Snapshot snapshot = ((Histogram) metric).getSnapshot();
      Double value = JStormUtils.formatDoubleDecPoint4(
          snapshot.getMean());
      histogramData.put(name, value);
    } else {
      LOG.warn("Unknown metric type, name:" + name);
    }
  }
View Full Code Here

      timer = base;
    }

    @Override
    public Double getValue() {
      Snapshot snapshot = timer.getSnapshot();
      return snapshot.getMedian() / 1000000;
    }
View Full Code Here

        }
    }

    private void logTimer(String name, Timer timer) {
        final Snapshot snapshot = timer.getSnapshot();
       
        logger.info(marker,
                    "type=TIMER, name={}, count={}, min={}, max={}, mean={}, stddev={}, median={}, " +
                            "p75={}, p95={}, p98={}, p99={}, p999={}, mean_rate={}, m1={}, m5={}, " +
                            "m15={}, rate_unit={}, duration_unit={}",
                    name,
                    timer.getCount(),
                    convertDuration(snapshot.getMin()),
                    convertDuration(snapshot.getMax()),
                    convertDuration(snapshot.getMean()),
                    convertDuration(snapshot.getStdDev()),
                    convertDuration(snapshot.getMedian()),
                    convertDuration(snapshot.get75thPercentile()),
                    convertDuration(snapshot.get95thPercentile()),
                    convertDuration(snapshot.get98thPercentile()),
                    convertDuration(snapshot.get99thPercentile()),
                    convertDuration(snapshot.get999thPercentile()),
                    convertRate(timer.getMeanRate()),
                    convertRate(timer.getOneMinuteRate()),
                    convertRate(timer.getFiveMinuteRate()),
                    convertRate(timer.getFifteenMinuteRate()),
                    getRateUnit(),
View Full Code Here

                    convertRate(meter.getFifteenMinuteRate()),
                    getRateUnit());
    }

    private void logHistogram(String name, Histogram histogram) {
        final Snapshot snapshot = histogram.getSnapshot();
        logger.info(marker,
                    "type=HISTOGRAM, name={}, count={}, min={}, max={}, mean={}, stddev={}, " +
                            "median={}, p75={}, p95={}, p98={}, p99={}, p999={}",
                    name,
                    histogram.getCount(),
                    snapshot.getMin(),
                    snapshot.getMax(),
                    snapshot.getMean(),
                    snapshot.getStdDev(),
                    snapshot.getMedian(),
                    snapshot.get75thPercentile(),
                    snapshot.get95thPercentile(),
                    snapshot.get98thPercentile(),
                    snapshot.get99thPercentile(),
                    snapshot.get999thPercentile());
    }
View Full Code Here

        LOG.warn("gauge value is null or unknow type.");
      } else {
        sum(gaugeData, name, value);
      }
        } else if (metric instanceof Timer) {
      Snapshot snapshot = ((Timer) metric).getSnapshot();
      //covert from ns to ms
      sum(timerData, name, (snapshot.getMean())/1000000);
    } else if (metric instanceof Counter) {
      Double value = ((Long) ((Counter) metric).getCount()).doubleValue()
        sum(counterData, name, value);
    } else if (metric instanceof Meter) {
      sum(meterData, name, ((Meter) metric).getMeanRate());
    } else if (metric instanceof Histogram) {
      Snapshot snapshot = ((Histogram)metric).getSnapshot();
      sum(histogramData, name, snapshot.getMean());
    } else {
      LOG.warn("Unknown metric type, name:" + name);
    }
    }
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.