public static Map<String, Double> explodeSampling(Sampling sampling) { return explodeSampling(sampling, false); }
public static Map<String, Double> explodeSampling(Sampling sampling) { return explodeSampling(sampling, false); }
private static void writeSampling(Sampling metric, JsonGenerator json) throws IOException { for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSampling(metric).entrySet()) { json.writeNumberField(entry.getKey(), entry.getValue()); } }
private static void writeSampling(Sampling metric, JsonGenerator json) throws IOException { for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSampling(metric).entrySet()) { json.writeNumberField(entry.getKey(), entry.getValue()); } }
private void writeSampling(MetricName name, Sampling sampling) throws Exception { for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSampling(sampling).entrySet()) { writeMetric(name, entry.getKey(), entry.getValue()); } }
@Override public void processHistogram(MetricName name, Histogram histogram, FlushProcessorContext context) throws Exception { if (histogram instanceof WavefrontHistogram && useWavefrontHistograms) { WavefrontHistogram wavefrontHistogram = (WavefrontHistogram) histogram; wavefront.report.Histogram.Builder builder = wavefront.report.Histogram.newBuilder(); builder.setBins(Lists.newLinkedList()); builder.setCounts(Lists.newLinkedList()); long minMillis = Long.MAX_VALUE; if (wavefrontHistogram.count() == 0) return; for (WavefrontHistogram.MinuteBin minuteBin : wavefrontHistogram.bins(true)) { builder.getBins().add(minuteBin.getDist().quantile(.5)); builder.getCounts().add(Math.toIntExact(minuteBin.getDist().size())); minMillis = Long.min(minMillis, minuteBin.getMinMillis()); } builder.setType(HistogramType.TDIGEST); builder.setDuration(Math.toIntExact(currentMillis.get() - minMillis)); context.report(builder.build()); } else { context.reportSubMetric(histogram.count(), "count"); for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSummarizable(histogram, reportEmptyHistogramStats).entrySet()) { context.reportSubMetric(entry.getValue(), entry.getKey()); } for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSampling(histogram, reportEmptyHistogramStats).entrySet()) { context.reportSubMetric(entry.getValue(), entry.getKey()); } histogram.clear(); } sentCounter.inc(); }
@Override public void processHistogram(MetricName name, Histogram histogram, FlushProcessorContext context) throws Exception { if (histogram instanceof WavefrontHistogram && useWavefrontHistograms) { WavefrontHistogram wavefrontHistogram = (WavefrontHistogram) histogram; wavefront.report.Histogram.Builder builder = wavefront.report.Histogram.newBuilder(); builder.setBins(Lists.newLinkedList()); builder.setCounts(Lists.newLinkedList()); long minMillis = Long.MAX_VALUE; if (wavefrontHistogram.count() == 0) return; for (WavefrontHistogram.MinuteBin minuteBin : wavefrontHistogram.bins(true)) { builder.getBins().add(minuteBin.getDist().quantile(.5)); builder.getCounts().add(Math.toIntExact(minuteBin.getDist().size())); minMillis = Long.min(minMillis, minuteBin.getMinMillis()); } builder.setType(HistogramType.TDIGEST); builder.setDuration(Math.toIntExact(currentMillis.get() - minMillis)); context.report(builder.build()); } else { context.reportSubMetric(histogram.count(), "count"); for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSummarizable(histogram, reportEmptyHistogramStats).entrySet()) { context.reportSubMetric(entry.getValue(), entry.getKey()); } for (Map.Entry<String, Double> entry : MetricsToTimeseries.explodeSampling(histogram, reportEmptyHistogramStats).entrySet()) { context.reportSubMetric(entry.getValue(), entry.getKey()); } histogram.clear(); } sentCounter.inc(); }