Package com.yammer.metrics.stats

Examples of com.yammer.metrics.stats.Snapshot


    return variance.get()[1] / (getCount() - 1);
  }

  @Override
  public void pushMetric(MetricsRecord mr) {
    final Snapshot s = this.getSnapshot();
    mr.setMetric(getName() + "_num_ops", this.getCount());
    mr.setMetric(getName() + "_min", this.getMin());
    mr.setMetric(getName() + "_max", this.getMax());
   
    mr.setMetric(getName() + "_mean", (float) this.getMean());
    mr.setMetric(getName() + "_std_dev", (float) this.getStdDev());
   
    mr.setMetric(getName() + "_median", (float) s.getMedian());
    mr.setMetric(getName() + "_75th_percentile",
        (float) s.get75thPercentile());
    mr.setMetric(getName() + "_95th_percentile",
        (float) s.get95thPercentile());
    mr.setMetric(getName() + "_99th_percentile",
        (float) s.get99thPercentile());
  }
View Full Code Here


            json.writeNumberField("mean", metric.mean());
            json.writeNumberField("std_dev", metric.stdDev());
        }

        private static void writeSampling(Sampling metric, JsonGenerator json) throws IOException {
            final Snapshot snapshot = metric.getSnapshot();
            json.writeNumberField("median", snapshot.getMedian());
            json.writeNumberField("p75", snapshot.get75thPercentile());
            json.writeNumberField("p95", snapshot.get95thPercentile());
            json.writeNumberField("p98", snapshot.get98thPercentile());
            json.writeNumberField("p99", snapshot.get99thPercentile());
            json.writeNumberField("p999", snapshot.get999thPercentile());
        }
View Full Code Here

    subtree.addFloat("mean", metric.mean());
    subtree.addFloat("stddev", metric.stdDev());
  }

  protected void sendSampling(MetricTreeObject subtree, Sampling metric) throws IOException {
    final Snapshot snapshot = metric.getSnapshot();
    subtree.addFloat("median", snapshot.getMedian());
    subtree.addFloat("75percentile", snapshot.get75thPercentile());
    subtree.addFloat("95percentile", snapshot.get95thPercentile());
    subtree.addFloat("98percentile", snapshot.get98thPercentile());
    subtree.addFloat("99percentile", snapshot.get99thPercentile());
    subtree.addFloat("999percentile", snapshot.get999thPercentile());
  }
View Full Code Here

        printReportToConsole(lastReport);

        if (latenciesMiddle == null)
            return;

        Snapshot snapshot = latenciesMiddle.getSnapshot();

        System.out.println();
        System.out.println("For the middle 80% of values:");
        System.out.println(String.format("  Mean rate (ops/sec):          %10.1f", meanMiddleRate));
        System.out.println(String.format("  Mean latency (ms):            %10.3f", latenciesMiddle.mean()));
        System.out.println(String.format("  Median latency (ms):          %10.3f", snapshot.getMedian()));
        System.out.println(String.format("  75th percentile latency (ms): %10.3f", snapshot.get75thPercentile()));
        System.out.println(String.format("  95th percentile latency (ms): %10.3f", snapshot.get95thPercentile()));
        System.out.println(String.format("  99th percentile latency (ms): %10.3f", snapshot.get99thPercentile()));
        System.out.println(String.format("  Standard latency deviation:   %10.3f", latenciesMiddle.stdDev()));
    }
View Full Code Here

            this.totalOps = meter.count();
            this.intervalRate = totalOps - lastOpCount;
            this.meanRate = meter.meanRate();

            Snapshot snapshot = timer.getSnapshot();
            this.meanLatency = timer.mean();
            this.latency95th = snapshot.get95thPercentile();
            this.latency99th = snapshot.get99thPercentile();
            this.stdDev = timer.stdDev();
        }
View Full Code Here

        histogram.getName() + "Mean",
        StringUtils.limitDecimalTo2(histogram.getMean()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "Count",
        StringUtils.limitDecimalTo2(histogram.getCount()));
    final Snapshot s = histogram.getSnapshot();
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "Median",
        StringUtils.limitDecimalTo2(s.getMedian()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "75th",
        StringUtils.limitDecimalTo2(s.get75thPercentile()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "95th",
        StringUtils.limitDecimalTo2(s.get95thPercentile()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "99th",
        StringUtils.limitDecimalTo2(s.get99thPercentile()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "999th",
        StringUtils.limitDecimalTo2(s.get999thPercentile()));
    return sb;
  }
View Full Code Here

          } else if (name.endsWith(MetricsHistogram.MEAN_METRIC_NAME)) {
            return (float) hist.getMean();
          } else if (name.endsWith(MetricsHistogram.STD_DEV_METRIC_NAME)) {
            return (float) hist.getStdDev();
          } else if (name.endsWith(MetricsHistogram.MEDIAN_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.getMedian();
          } else if (name.endsWith(MetricsHistogram.SEVENTY_FIFTH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get75thPercentile();
          } else if (name.endsWith(MetricsHistogram.NINETY_FIFTH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get95thPercentile();
          } else if (name.endsWith(MetricsHistogram.NINETY_NINETH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get99thPercentile();
          }

        } else {
          LOG.warn( String.format("unknown metrics type %s for attribute %s",
                        metric.getClass().getName(), name) );
View Full Code Here

        histogram.getName() + "Mean",
        StringUtils.limitDecimalTo2(histogram.getMean()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "Count",
        StringUtils.limitDecimalTo2(histogram.getCount()));
    final Snapshot s = histogram.getSnapshot();
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "Median",
        StringUtils.limitDecimalTo2(s.getMedian()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "75th",
        StringUtils.limitDecimalTo2(s.get75thPercentile()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "95th",
        StringUtils.limitDecimalTo2(s.get95thPercentile()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "99th",
        StringUtils.limitDecimalTo2(s.get99thPercentile()));
    sb = Strings.appendKeyValue(sb,
        histogram.getName() + "999th",
        StringUtils.limitDecimalTo2(s.get999thPercentile()));
    return sb;
  }
View Full Code Here

      histogramJsonObject.put("min", histogram.min());
      histogramJsonObject.put("max", histogram.max());
      histogramJsonObject.put("mean", histogram.mean());
      histogramJsonObject.put("stdDev", histogram.stdDev());

      Snapshot snapshot = histogram.getSnapshot();
      JSONObject snapshotJsonObject = new JSONObject();
      snapshotJsonObject.put("median", snapshot.getMedian());
      snapshotJsonObject.put("75%", snapshot.get75thPercentile());
      snapshotJsonObject.put("95%", snapshot.get95thPercentile());
      snapshotJsonObject.put("98%", snapshot.get98thPercentile());
      snapshotJsonObject.put("99%", snapshot.get99thPercentile());
      snapshotJsonObject.put("99.9%", snapshot.get999thPercentile());

      histogramJsonObject.put("snapshot", snapshotJsonObject);

      jsonObject.put("value", histogramJsonObject);
      context.write(jsonObject);
View Full Code Here

      timerJsonObject.put("max", timer.max());
      timerJsonObject.put("mean", timer.mean());
      timerJsonObject.put("stdDev", timer.stdDev());
      addMeterInfo(timer, timerJsonObject);

      Snapshot snapshot = timer.getSnapshot();
      JSONObject snapshotJsonObject = new JSONObject();
      snapshotJsonObject.put("median", snapshot.getMedian());
      snapshotJsonObject.put("75%", snapshot.get75thPercentile());
      snapshotJsonObject.put("95%", snapshot.get95thPercentile());
      snapshotJsonObject.put("98%", snapshot.get98thPercentile());
      snapshotJsonObject.put("99%", snapshot.get99thPercentile());
      snapshotJsonObject.put("99.9%", snapshot.get999thPercentile());

      timerJsonObject.put("snapshot", snapshotJsonObject);

      jsonObject.put("value", timerJsonObject);
View Full Code Here

TOP

Related Classes of com.yammer.metrics.stats.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.