com.yammer.metrics.stats.Snapshot Java Examples
The following examples show how to use
com.yammer.metrics.stats.Snapshot.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KafkaMetricsProcessor.java From kafka-metrics with Apache License 2.0 | 6 votes |
@Override public void processHistogram(MetricName name, Histogram histogram, Long timestamp) { Map<String, Double> fields = new HashMap<String, Double>(); fields.put("Count", Double.valueOf(histogram.count())); fields.put("Max", histogram.max()); fields.put("Mean", histogram.mean()); fields.put("Min", histogram.min()); fields.put("StdDev", histogram.stdDev()); fields.put("Sum", histogram.sum()); Snapshot snapshot = histogram.getSnapshot(); fields.put("95thPercentile", snapshot.get95thPercentile()); fields.put("98thPercentile", snapshot.get98thPercentile()); fields.put("99thPercentile", snapshot.get99thPercentile()); fields.put("999thPercentile", snapshot.get999thPercentile()); publish(createMeasurement(name, timestamp, fixedTags, fields)); }
Example #2
Source File: MemoryReporter.java From incubator-retired-blur with Apache License 2.0 | 6 votes |
@Override public void processHistogram(MetricName name, Histogram histogram, ConcurrentMap<String, org.apache.blur.thrift.generated.Metric> context) throws Exception { org.apache.blur.thrift.generated.Metric metric = getMetric(name, context); metric.putToDoubleMap("min", histogram.min()); metric.putToDoubleMap("max", histogram.max()); metric.putToDoubleMap("mean", histogram.mean()); metric.putToDoubleMap("stdDev", histogram.stdDev()); Snapshot snapshot = histogram.getSnapshot(); metric.putToDoubleMap("median", snapshot.getMedian()); metric.putToDoubleMap("75%", snapshot.get75thPercentile()); metric.putToDoubleMap("95%", snapshot.get95thPercentile()); metric.putToDoubleMap("98%", snapshot.get98thPercentile()); metric.putToDoubleMap("99%", snapshot.get99thPercentile()); metric.putToDoubleMap("99.9%", snapshot.get999thPercentile()); }
Example #3
Source File: MemoryReporter.java From incubator-retired-blur with Apache License 2.0 | 6 votes |
@Override public void processTimer(MetricName name, Timer timer, ConcurrentMap<String, org.apache.blur.thrift.generated.Metric> context) throws Exception { org.apache.blur.thrift.generated.Metric metric = getMetric(name, context); addMeter(metric, timer, context); metric.putToStrMap("unit", timer.durationUnit().toString()); metric.putToDoubleMap("min", timer.min()); metric.putToDoubleMap("max", timer.max()); metric.putToDoubleMap("mean", timer.mean()); metric.putToDoubleMap("stdDev", timer.stdDev()); Snapshot snapshot = timer.getSnapshot(); metric.putToDoubleMap("median", snapshot.getMedian()); metric.putToDoubleMap("75%", snapshot.get75thPercentile()); metric.putToDoubleMap("95%", snapshot.get95thPercentile()); metric.putToDoubleMap("98%", snapshot.get98thPercentile()); metric.putToDoubleMap("99%", snapshot.get99thPercentile()); metric.putToDoubleMap("99.9%", snapshot.get999thPercentile()); }
Example #4
Source File: CustomReporter.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
@Override public void processHistogram(final MetricName name, final Histogram histogram, final PrintStream stream) { final Snapshot snapshot = histogram.getSnapshot(); stream.printf(locale, " min = %,2.2f\n", histogram.min()); stream.printf(locale, " max = %,2.2f\n", histogram.max()); stream.printf(locale, " mean = %,2.2f\n", histogram.mean()); stream.printf(locale, " stddev = %,2.2f\n", histogram.stdDev()); stream.printf(locale, " median = %,2.2f\n", snapshot.getMedian()); stream.printf(locale, " 75%% <= %,2.2f\n", snapshot.get75thPercentile()); stream.printf(locale, " 95%% <= %,2.2f\n", snapshot.get95thPercentile()); stream.printf(locale, " 98%% <= %,2.2f\n", snapshot.get98thPercentile()); stream.printf(locale, " 99%% <= %,2.2f\n", snapshot.get99thPercentile()); stream.printf(locale, " 99.9%% <= %,2.2f\n", snapshot.get999thPercentile()); }
Example #5
Source File: JSONReporter.java From incubator-retired-blur with Apache License 2.0 | 6 votes |
@Override public void processHistogram(MetricName name, Histogram histogram, Context context) throws Exception { MetricInfo info = context.getMetricInfo(name); long time = context.getTime(); info.addNumber("timestamp", time); info.addNumber("min", histogram.min()); info.addNumber("max", histogram.max()); info.addNumber("mean", histogram.mean()); info.addNumber("stdDev", histogram.stdDev()); Snapshot snapshot = histogram.getSnapshot(); info.addNumber("median", snapshot.getMedian()); info.addNumber("75%", snapshot.get75thPercentile()); info.addNumber("95%", snapshot.get95thPercentile()); info.addNumber("98%", snapshot.get98thPercentile()); info.addNumber("99%", snapshot.get99thPercentile()); info.addNumber("99.9%", snapshot.get999thPercentile()); }
Example #6
Source File: JSONReporter.java From incubator-retired-blur with Apache License 2.0 | 6 votes |
@Override public void processTimer(MetricName name, Timer timer, Context context) throws Exception { MetricInfo info = context.getMetricInfo(name); long time = context.getTime(); addMeterInfo(time, timer, info); info.setMetaData("unit", timer.durationUnit().toString()); info.addNumber("min", timer.min()); info.addNumber("max", timer.max()); info.addNumber("mean", timer.mean()); info.addNumber("stdDev", timer.stdDev()); Snapshot snapshot = timer.getSnapshot(); info.addNumber("median", snapshot.getMedian()); info.addNumber("75%", snapshot.get75thPercentile()); info.addNumber("95%", snapshot.get95thPercentile()); info.addNumber("98%", snapshot.get98thPercentile()); info.addNumber("99%", snapshot.get99thPercentile()); info.addNumber("99.9%", snapshot.get999thPercentile()); }
Example #7
Source File: YammerFacadeMetric.java From storm-metrics-reporter with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public void processHistogram(final MetricName metricName, final Histogram histogram, final Map context) throws Exception { final Snapshot snapshot = histogram.getSnapshot(); final Map subMetrics = ImmutableMap .builder() .put("75percentile", snapshot.get75thPercentile()) .put("95percentile", snapshot.get95thPercentile()) .put("99percentile", snapshot.get99thPercentile()) .put("median", snapshot.getMedian()) .put("mean", histogram.mean()) .put("min", histogram.min()) .put("max", histogram.max()) .put("stddev", histogram.stdDev()) .build(); context.put(toString(metricName), subMetrics); }
Example #8
Source File: FilteredGraphiteReporter.java From kafka-graphite with Apache License 2.0 | 6 votes |
@Override protected void sendSampling(long epoch, String sanitizedName, Sampling metric) throws IOException { final Snapshot snapshot = metric.getSnapshot(); if (dimensions.contains(median)) sendFloat(epoch, sanitizedName, "median", snapshot.getMedian()); if (dimensions.contains(p75)) sendFloat(epoch, sanitizedName, "75percentile", snapshot.get75thPercentile()); if (dimensions.contains(p95)) sendFloat(epoch, sanitizedName, "95percentile", snapshot.get95thPercentile()); if (dimensions.contains(p98)) sendFloat(epoch, sanitizedName, "98percentile", snapshot.get98thPercentile()); if (dimensions.contains(p99)) sendFloat(epoch, sanitizedName, "99percentile", snapshot.get99thPercentile()); if (dimensions.contains(p999)) sendFloat(epoch, sanitizedName, "999percentile", snapshot.get999thPercentile()); }
Example #9
Source File: YammerFacadeMetric.java From storm-metrics-reporter with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public void processTimer(final MetricName name, final Timer timer, final Map context) throws Exception { final Snapshot snapshot = timer.getSnapshot(); final Map subMetrics = ImmutableMap .builder() .put("count", timer.count()) .put("median", snapshot.getMedian()) .put("75percentile", snapshot.get75thPercentile()) .put("95percentile", snapshot.get95thPercentile()) .put("99percentile", snapshot.get99thPercentile()) .build(); context.put(toString(name), subMetrics); }
Example #10
Source File: CustomReporter.java From netty4.0.27Learn with Apache License 2.0 | 6 votes |
@Override public void processHistogram(final MetricName name, final Histogram histogram, final PrintStream stream) { final Snapshot snapshot = histogram.getSnapshot(); stream.printf(locale, " min = %,2.2f\n", histogram.min()); stream.printf(locale, " max = %,2.2f\n", histogram.max()); stream.printf(locale, " mean = %,2.2f\n", histogram.mean()); stream.printf(locale, " stddev = %,2.2f\n", histogram.stdDev()); stream.printf(locale, " median = %,2.2f\n", snapshot.getMedian()); stream.printf(locale, " 75%% <= %,2.2f\n", snapshot.get75thPercentile()); stream.printf(locale, " 95%% <= %,2.2f\n", snapshot.get95thPercentile()); stream.printf(locale, " 98%% <= %,2.2f\n", snapshot.get98thPercentile()); stream.printf(locale, " 99%% <= %,2.2f\n", snapshot.get99thPercentile()); stream.printf(locale, " 99.9%% <= %,2.2f\n", snapshot.get999thPercentile()); }
Example #11
Source File: AggregateMetricSenderSessionWrapper.java From signalfx-java with Apache License 2.0 | 6 votes |
/** * calculate standard deviation for snapshot * @param shapshot * @return */ private double getStdDev(Snapshot snapshot) { // two-pass algorithm for variance, avoids numeric overflow double[] values = snapshot.getValues(); if (values.length <= 1) { return 0; } final double mean = getMean(snapshot); double sum = 0; for (double value : values) { final double diff = value - mean; sum += diff * diff; } final double variance = sum / (values.length - 1); return Math.sqrt(variance); }
Example #12
Source File: KafkaTimelineMetricsReporter.java From ambari-metrics with Apache License 2.0 | 6 votes |
private String[] cacheKafkaSnapshot(long currentTimeMillis, String sanitizedName, Snapshot snapshot) { final String medianName = cacheSanitizedTimelineMetric(currentTimeMillis, sanitizedName, MEDIAN_SUFIX, snapshot.getMedian()); final String seventyFifthPercentileName = cacheSanitizedTimelineMetric(currentTimeMillis, sanitizedName, SEVENTY_FIFTH_PERCENTILE_SUFIX, snapshot.get75thPercentile()); final String ninetyFifthPercentileName = cacheSanitizedTimelineMetric(currentTimeMillis, sanitizedName, NINETY_FIFTH_PERCENTILE_SUFIX, snapshot.get95thPercentile()); final String ninetyEighthPercentileName = cacheSanitizedTimelineMetric(currentTimeMillis, sanitizedName, NINETY_EIGHTH_PERCENTILE_SUFIX, snapshot.get98thPercentile()); final String ninetyNinthPercentileName = cacheSanitizedTimelineMetric(currentTimeMillis, sanitizedName, NINETY_NINTH_PERCENTILE_SUFIX, snapshot.get99thPercentile()); final String ninetyNinePointNinePercentileName = cacheSanitizedTimelineMetric(currentTimeMillis, sanitizedName, NINETY_NINE_POINT_NINE_PERCENTILE_SUFIX, snapshot.get999thPercentile()); return new String[] { medianName, ninetyEighthPercentileName, ninetyFifthPercentileName, ninetyNinePointNinePercentileName, ninetyNinthPercentileName, seventyFifthPercentileName }; }
Example #13
Source File: AggregateMetricSenderSessionWrapper.java From signalfx-java with Apache License 2.0 | 6 votes |
/** * calculate Mean value for snapshot * @param shapshot * @return */ private double getMean(Snapshot shapshot) { double[] values = shapshot.getValues(); if (values.length == 0) { return 0; } double sum = 0; for (double value : values) { sum += value; } return sum / values.length; }
Example #14
Source File: LatencyMetric.java From incubator-pinot with Apache License 2.0 | 6 votes |
public LatencyMetric(T h) { Snapshot s = h.getSnapshot(); _min = h.min(); _max = h.max(); _mean = h.mean(); if (null != s) { _percentile95 = s.get95thPercentile(); _percentile99 = s.get99thPercentile(); _percentile999 = s.get999thPercentile(); } else { _percentile95 = -1; _percentile99 = -1; _percentile999 = -1; } _histogram = h; }
Example #15
Source File: StatsDReporter.java From kafka-statsd-metrics2 with Apache License 2.0 | 5 votes |
protected void send(Sampling metric) { final Snapshot snapshot = metric.getSnapshot(); double[] values = {snapshot.getMedian(), snapshot.get75thPercentile(), snapshot.get95thPercentile(), snapshot.get98thPercentile(), snapshot.get99thPercentile(), snapshot.get999thPercentile()}; for (int i = 0; i < values.length; ++i) { sendDouble(SamplingDims[i], values[i]); } }
Example #16
Source File: AggregateMetricSenderSessionWrapper.java From signalfx-java with Apache License 2.0 | 5 votes |
/** * calculate Max value for snapshot * @param shapshot * @return */ private double getMax(Snapshot snapshot) { double[] values = snapshot.getValues(); if (values.length == 0) { return 0; } return values[values.length - 1]; }
Example #17
Source File: AggregateMetricSenderSessionWrapper.java From signalfx-java with Apache License 2.0 | 5 votes |
/** * calculate Min value for snapshot * @param shapshot * @return */ private double getMin(Snapshot snapshot) { double[] values = snapshot.getValues(); if (values.length == 0) { return 0; } return values[0]; }
Example #18
Source File: RootResource.java From usergrid with Apache License 2.0 | 5 votes |
private static void writeSampling( Sampling metric, ObjectNode mNode ) throws IOException { final Snapshot snapshot = metric.getSnapshot(); mNode.put( "median", snapshot.getMedian() ); mNode.put( "p75", snapshot.get75thPercentile() ); mNode.put( "p95", snapshot.get95thPercentile() ); mNode.put( "p98", snapshot.get98thPercentile() ); mNode.put( "p99", snapshot.get99thPercentile() ); mNode.put( "p999", snapshot.get999thPercentile() ); }
Example #19
Source File: StatsDReporterTest.java From kafka-statsd-metrics2 with Apache License 2.0 | 5 votes |
static void setupSamplingMock(Sampling sampling) { //be careful how snapshot defines statistics final double[] values = new double[1001]; for (int i = 0; i < values.length; i++) { values[i] = i / 1000.0; } when(sampling.getSnapshot()).thenReturn(new Snapshot(values)); }
Example #20
Source File: TopicReporter.java From metrics-kafka with Apache License 2.0 | 5 votes |
public void processTimer(MetricName name, Timer timer, Context context) { final String header = "# time,min,max,mean,median,stddev,95%,99%,99.9%"; final Producer producer = context.getProducer(); final Snapshot snapshot = timer.getSnapshot(); final String topic="%s-metrics-timer".format(prefix); final String message = valueOf(timer.min()) + ',' + timer.max() + ',' + timer.mean() + ',' + snapshot.getMedian() + ',' + timer.stdDev() + ',' + snapshot.get95thPercentile() + ',' + snapshot.get99thPercentile() + ',' + snapshot.get999thPercentile(); send(producer, header, topic, message); }
Example #21
Source File: TopicReporter.java From metrics-kafka with Apache License 2.0 | 5 votes |
public void processHistogram(MetricName name, Histogram histogram, Context context) { final String header = "# time,min,max,mean,median,stddev,95%,99%,99.9%"; final Producer producer = context.getProducer(); final Snapshot snapshot = histogram.getSnapshot(); final String topic="%s-metrics-histogram".format(prefix); final String message = valueOf(histogram.min()) + ',' + histogram.max() + ',' + histogram.mean() + ',' + snapshot.getMedian() + ',' + histogram.stdDev() + ',' + snapshot.get95thPercentile() + ',' + snapshot.get99thPercentile() + ',' + snapshot.get999thPercentile(); send(producer, header, topic, message); }
Example #22
Source File: StatsdReporter.java From kafka-statsd-reporter with MIT License | 5 votes |
protected void sendSampling(String sanitizedName, Sampling metric) throws IOException { final Snapshot snapshot = metric.getSnapshot(); sendStatsd(sanitizedName + ".p50", format(snapshot.getMedian()), StatType.TIMER); sendStatsd(sanitizedName + ".p75", format(snapshot.get75thPercentile()), StatType.TIMER); sendStatsd(sanitizedName + ".p95", format(snapshot.get95thPercentile()), StatType.TIMER); sendStatsd(sanitizedName + ".p98", format(snapshot.get98thPercentile()), StatType.TIMER); sendStatsd(sanitizedName + ".p99", format(snapshot.get99thPercentile()), StatType.TIMER); sendStatsd(sanitizedName + ".p999", format(snapshot.get999thPercentile()), StatType.TIMER); }
Example #23
Source File: CustomReporter.java From netty4.0.27Learn with Apache License 2.0 | 5 votes |
@Override public void processTimer(final MetricName name, final Timer timer, final PrintStream stream) { processMeter(name, timer, stream); final String durationUnit = abbrev(timer.durationUnit()); final Snapshot snapshot = timer.getSnapshot(); stream.printf(locale, " min = %,2.2f %s\n", timer.min(), durationUnit); stream.printf(locale, " max = %,2.2f %s\n", timer.max(), durationUnit); stream.printf(locale, " mean = %,2.2f %s\n", timer.mean(), durationUnit); stream.printf(locale, " stddev = %,2.2f %s\n", timer.stdDev(), durationUnit); stream.printf(locale, " median = %,2.2f %s\n", snapshot.getMedian(), durationUnit); stream.printf(locale, " 75%% <= %,2.2f %s\n", snapshot.get75thPercentile(), durationUnit); stream.printf(locale, " 95%% <= %,2.2f %s\n", snapshot.get95thPercentile(), durationUnit); stream.printf(locale, " 98%% <= %,2.2f %s\n", snapshot.get98thPercentile(), durationUnit); stream.printf(locale, " 99%% <= %,2.2f %s\n", snapshot.get99thPercentile(), durationUnit); stream.printf(locale, " 99.9%% <= %,2.2f %s\n", snapshot.get999thPercentile(), durationUnit); }
Example #24
Source File: YammerMetricProcessor.java From cruise-control with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void processHistogram(MetricName metricName, Histogram histogram, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Histogram.", metricName); // Get max metric value CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, histogram.max(), MetricsUtils.ATTRIBUTE_MAX); context.reporter().sendCruiseControlMetric(ccm); // Get mean metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, histogram.mean(), MetricsUtils.ATTRIBUTE_MEAN); context.reporter().sendCruiseControlMetric(ccm); Snapshot snapshot = histogram.getSnapshot(); // Get 50th percentile (i.e. median) metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, snapshot.getMedian(), MetricsUtils.ATTRIBUTE_50TH_PERCENTILE); context.reporter().sendCruiseControlMetric(ccm); // Get 999th percentile metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, snapshot.get999thPercentile(), MetricsUtils.ATTRIBUTE_999TH_PERCENTILE); context.reporter().sendCruiseControlMetric(ccm); } }
Example #25
Source File: KafkaTimelineMetricsReporter.java From ambari-metrics with Apache License 2.0 | 5 votes |
@Override public void processTimer(MetricName name, Timer timer, Context context) throws Exception { final long currentTimeMillis = System.currentTimeMillis(); final Snapshot snapshot = timer.getSnapshot(); final String sanitizedName = sanitizeName(name); String[] metricMNames = cacheKafkaMetered(currentTimeMillis, sanitizedName, timer); String[] metricTNames = cacheKafkaSummarizable(currentTimeMillis, sanitizedName, timer); String[] metricSNames = cacheKafkaSnapshot(currentTimeMillis, sanitizedName, snapshot); String[] metricNames = (String[]) ArrayUtils.addAll(metricMNames, metricTNames); metricNames = (String[]) ArrayUtils.addAll(metricNames, metricSNames); populateMetricsList(context, MetricType.GAUGE, metricNames); }
Example #26
Source File: KafkaTimelineMetricsReporter.java From ambari-metrics with Apache License 2.0 | 5 votes |
@Override public void processHistogram(MetricName name, Histogram histogram, Context context) throws Exception { final long currentTimeMillis = System.currentTimeMillis(); final Snapshot snapshot = histogram.getSnapshot(); final String sanitizedName = sanitizeName(name); String[] metricHNames = cacheKafkaSummarizable(currentTimeMillis, sanitizedName, histogram); String[] metricSNames = cacheKafkaSnapshot(currentTimeMillis, sanitizedName, snapshot); String[] metricNames = (String[]) ArrayUtils.addAll(metricHNames, metricSNames); populateMetricsList(context, MetricType.GAUGE, metricNames); }
Example #27
Source File: CustomReporter.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override public void processTimer(final MetricName name, final Timer timer, final PrintStream stream) { processMeter(name, timer, stream); final String durationUnit = abbrev(timer.durationUnit()); final Snapshot snapshot = timer.getSnapshot(); stream.printf(locale, " min = %,2.2f %s\n", timer.min(), durationUnit); stream.printf(locale, " max = %,2.2f %s\n", timer.max(), durationUnit); stream.printf(locale, " mean = %,2.2f %s\n", timer.mean(), durationUnit); stream.printf(locale, " stddev = %,2.2f %s\n", timer.stdDev(), durationUnit); stream.printf(locale, " median = %,2.2f %s\n", snapshot.getMedian(), durationUnit); stream.printf(locale, " 75%% <= %,2.2f %s\n", snapshot.get75thPercentile(), durationUnit); stream.printf(locale, " 95%% <= %,2.2f %s\n", snapshot.get95thPercentile(), durationUnit); stream.printf(locale, " 98%% <= %,2.2f %s\n", snapshot.get98thPercentile(), durationUnit); stream.printf(locale, " 99%% <= %,2.2f %s\n", snapshot.get99thPercentile(), durationUnit); stream.printf(locale, " 99.9%% <= %,2.2f %s\n", snapshot.get999thPercentile(), durationUnit); }
Example #28
Source File: LongBTreeTest.java From stratio-cassandra with Apache License 2.0 | 4 votes |
private static void testInsertions(int totalCount, int perTestCount, int testKeyRatio, int modificationBatchSize, boolean quickEquality) throws ExecutionException, InterruptedException { int batchesPerTest = perTestCount / modificationBatchSize; int maximumRunLength = 100; int testKeyRange = perTestCount * testKeyRatio; int tests = totalCount / perTestCount; System.out.println(String.format("Performing %d tests of %d operations, with %.2f max size/key-range ratio in batches of ~%d ops", tests, perTestCount, 1 / (float) testKeyRatio, modificationBatchSize)); // if we're not doing quick-equality, we can spam with garbage for all the checks we perform, so we'll split the work into smaller chunks int chunkSize = quickEquality ? tests : (int) (100000 / Math.pow(perTestCount, 2)); for (int chunk = 0 ; chunk < tests ; chunk += chunkSize) { final List<ListenableFutureTask<List<ListenableFuture<?>>>> outer = new ArrayList<>(); for (int i = 0 ; i < chunkSize ; i++) { outer.add(doOneTestInsertions(testKeyRange, maximumRunLength, modificationBatchSize, batchesPerTest, quickEquality)); } final List<ListenableFuture<?>> inner = new ArrayList<>(); int complete = 0; int reportInterval = totalCount / 100; int lastReportAt = 0; for (ListenableFutureTask<List<ListenableFuture<?>>> f : outer) { inner.addAll(f.get()); complete += perTestCount; if (complete - lastReportAt >= reportInterval) { System.out.println(String.format("Completed %d of %d operations", (chunk * perTestCount) + complete, totalCount)); lastReportAt = complete; } } Futures.allAsList(inner).get(); } Snapshot snap = BTREE_TIMER.getSnapshot(); System.out.println(String.format("btree : %.2fns, %.2fns, %.2fns", snap.getMedian(), snap.get95thPercentile(), snap.get999thPercentile())); snap = TREE_TIMER.getSnapshot(); System.out.println(String.format("snaptree: %.2fns, %.2fns, %.2fns", snap.getMedian(), snap.get95thPercentile(), snap.get999thPercentile())); System.out.println("Done"); }
Example #29
Source File: AggregateMetricSenderSessionWrapper.java From signalfx-java with Apache License 2.0 | 4 votes |
/** * Add sampling * @param baseName * @param sampling */ private void addSampling(MetricName baseName, Sampling sampling) { Metric metric = (Metric)sampling; final Snapshot snapshot = sampling.getSnapshot(); addMetric(metric, baseName, SignalFxReporter.MetricDetails.MEDIAN, SignalFxProtocolBuffers.MetricType.GAUGE, snapshot.getMedian()); addMetric(metric, baseName, SignalFxReporter.MetricDetails.PERCENT_75, SignalFxProtocolBuffers.MetricType.GAUGE, snapshot.get75thPercentile()); addMetric(metric, baseName, SignalFxReporter.MetricDetails.PERCENT_95, SignalFxProtocolBuffers.MetricType.GAUGE, snapshot.get95thPercentile()); addMetric(metric, baseName, SignalFxReporter.MetricDetails.PERCENT_98, SignalFxProtocolBuffers.MetricType.GAUGE, snapshot.get98thPercentile()); addMetric(metric, baseName, SignalFxReporter.MetricDetails.PERCENT_99, SignalFxProtocolBuffers.MetricType.GAUGE, snapshot.get99thPercentile()); addMetric(metric, baseName, SignalFxReporter.MetricDetails.PERCENT_999, SignalFxProtocolBuffers.MetricType.GAUGE, snapshot.get999thPercentile()); addMetric(metric, baseName, SignalFxReporter.MetricDetails.MAX, SignalFxProtocolBuffers.MetricType.GAUGE, getMax(snapshot)); addMetric(metric, baseName, SignalFxReporter.MetricDetails.MIN, SignalFxProtocolBuffers.MetricType.GAUGE, getMin(snapshot)); // These are slower to calculate. Only calculate if we need. if (detailsToAdd.contains(SignalFxReporter.MetricDetails.STD_DEV)) { addMetric(metric, baseName, SignalFxReporter.MetricDetails.STD_DEV, SignalFxProtocolBuffers.MetricType.GAUGE, getStdDev(snapshot)); } if (detailsToAdd.contains(SignalFxReporter.MetricDetails.MEAN)) { addMetric(metric, baseName, SignalFxReporter.MetricDetails.MEAN, SignalFxProtocolBuffers.MetricType.GAUGE, getMean(snapshot)); } }
Example #30
Source File: YammerMetricProcessor.java From cruise-control with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void processTimer(MetricName metricName, Timer timer, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Timer.", metricName); CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, timer.fiveMinuteRate()); context.reporter().sendCruiseControlMetric(ccm); // Get max metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, timer.max(), MetricsUtils.ATTRIBUTE_MAX); context.reporter().sendCruiseControlMetric(ccm); // Get mean metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, timer.mean(), MetricsUtils.ATTRIBUTE_MEAN); context.reporter().sendCruiseControlMetric(ccm); Snapshot snapshot = timer.getSnapshot(); // Get 50th percentile (i.e. median) metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, snapshot.getMedian(), MetricsUtils.ATTRIBUTE_50TH_PERCENTILE); context.reporter().sendCruiseControlMetric(ccm); // Get 999th percentile metric value ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, snapshot.get999thPercentile(), MetricsUtils.ATTRIBUTE_999TH_PERCENTILE); context.reporter().sendCruiseControlMetric(ccm); } }