@Override public List<Double> dumpTimings(String hostname) throws UnknownHostException { NetEndpoint host = NetEndpoint.getByName(hostname); ArrayList<Double> timings = new ArrayList<Double>(); ExponentiallyDecayingSample sample = samples.get(host); if (sample != null) { for (double time : sample.getSnapshot().getValues()) timings.add(time); } return timings; }
meanSum += h.mean(); double[] val = hist.getSnapshot().getValues(); for (double d : val) { values.add(d);
@Override public double[] values() { return metric.getSnapshot().getValues(); } }
@Override public double[] values() { return metric.getSnapshot().getValues(); } }
public List<Double> dumpTimings(String hostname) throws UnknownHostException { InetAddress host = InetAddress.getByName(hostname); ArrayList<Double> timings = new ArrayList<Double>(); ExponentiallyDecayingSample sample = samples.get(host); if (sample != null) { for (double time: sample.getSnapshot().getValues()) timings.add(time); } return timings; }
private void internalProcessYammerHistogram(Histogram histogram, Context context) throws Exception { final JsonGenerator json = context.json; json.writeStartObject(); { json.writeNumberField("count", histogram.count()); writeSummarizable(histogram, json); writeSampling(histogram, json); if (context.showFullSamples) { json.writeObjectField("values", histogram.getSnapshot().getValues()); } if (clear) histogram.clear(); } json.writeEndObject(); }
private void internalProcessYammerHistogram(Histogram histogram, Context context) throws Exception { final JsonGenerator json = context.json; json.writeStartObject(); { json.writeNumberField("count", histogram.count()); writeSummarizable(histogram, json); writeSampling(histogram, json); if (context.showFullSamples) { json.writeObjectField("values", histogram.getSnapshot().getValues()); } if (clear) histogram.clear(); } json.writeEndObject(); }
@Override public void processHistogram(MetricName name, Histogram histogram, Context context) throws Exception { final JsonGenerator json = context.json; json.writeStartObject(); { json.writeStringField("type", "histogram"); json.writeNumberField("count", histogram.count()); writeSummarizable(histogram, json); writeSampling(histogram, json); if (context.showFullSamples) { json.writeObjectField("values", histogram.getSnapshot().getValues()); } } json.writeEndObject(); }
@Override public void processTimer(MetricName name, Timer timer, Context context) throws Exception { final JsonGenerator json = context.json; json.writeStartObject(); { json.writeFieldName("duration"); json.writeStartObject(); { json.writeStringField("unit", timer.durationUnit().toString().toLowerCase()); writeSummarizable(timer, json); writeSampling(timer, json); if (context.showFullSamples) { json.writeObjectField("values", timer.getSnapshot().getValues()); } } json.writeEndObject(); json.writeFieldName("rate"); json.writeStartObject(); { writeMeteredFields(timer, json); } json.writeEndObject(); } json.writeEndObject(); if (clear) timer.clear(); } }
@Override public void processTimer(MetricName name, Timer timer, Context context) throws Exception { final JsonGenerator json = context.json; json.writeStartObject(); { json.writeFieldName("duration"); json.writeStartObject(); { json.writeStringField("unit", timer.durationUnit().toString().toLowerCase()); writeSummarizable(timer, json); writeSampling(timer, json); if (context.showFullSamples) { json.writeObjectField("values", timer.getSnapshot().getValues()); } } json.writeEndObject(); json.writeFieldName("rate"); json.writeStartObject(); { writeMeteredFields(timer, json); } json.writeEndObject(); } json.writeEndObject(); if (clear) timer.clear(); } }
@Override public void processTimer(MetricName name, Timer timer, Context context) throws Exception { final JsonGenerator json = context.json; json.writeStartObject(); { json.writeStringField("type", "timer"); json.writeFieldName("duration"); json.writeStartObject(); { json.writeStringField("unit", timer.durationUnit().toString().toLowerCase()); writeSummarizable(timer, json); writeSampling(timer, json); if (context.showFullSamples) { json.writeObjectField("values", timer.getSnapshot().getValues()); } } json.writeEndObject(); json.writeFieldName("rate"); json.writeStartObject(); { writeMeteredFields(timer, json); } json.writeEndObject(); } json.writeEndObject(); }
@Override public Snapshot getSnapshot() { final double[] values = histogram.getSnapshot().getValues(); final double[] converted = new double[values.length]; for (int i = 0; i < values.length; i++) { converted[i] = convertFromNS(values[i]); } return new Snapshot(converted); }
@Override public ValueObject getValue(String key) { if ((key == null) || key.isEmpty() || "mean".equals(key)) { return ValueFactory.create(histogram.mean()); } else if ("max".equals(key)) { return ValueFactory.create(histogram.max()); } else if ("min".equals(key)) { return ValueFactory.create(histogram.min()); } else if ("stdev".equals(key)) { return ValueFactory.create(histogram.stdDev()); } else if ("median".equals(key)) { return ValueFactory.create(histogram.getSnapshot().getMedian()); } else if ("snapshot".equals(key)) { return ValueFactory.create(Arrays.toString(histogram.getSnapshot().getValues())); } else if ("75".equals(key)) { return ValueFactory.create(histogram.getSnapshot().get75thPercentile()); } else if ("95".equals(key)) { return ValueFactory.create(histogram.getSnapshot().get95thPercentile()); } else if ("98".equals(key)) { return ValueFactory.create(histogram.getSnapshot().get98thPercentile()); } else if ("99".equals(key)) { return ValueFactory.create(histogram.getSnapshot().get99thPercentile()); } else if ("999".equals(key)) { return ValueFactory.create(histogram.getSnapshot().get999thPercentile()); } else { throw new UnsupportedOperationException("Unhandled key: " + key); } }