com.yammer.metrics.core.Histogram.clear()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中com.yammer.metrics.core.Histogram.clear()方法的一些代码示例,展示了Histogram.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.clear()方法的具体详情如下:
包路径:com.yammer.metrics.core.Histogram
类名称:Histogram
方法名:clear

Histogram.clear介绍

[英]Clears all recorded values.
[中]清除所有记录的值。

代码示例

代码示例来源:origin: com.yammer.metrics/metrics-core

/**
 * Creates a new {@link Histogram} with the given sample.
 *
 * @param sample the sample to create a histogram from
 */
Histogram(Sample sample) {
  this.sample = sample;
  clear();
}

代码示例来源:origin: com.yammer.metrics/metrics-core

/**
 * Clears all recorded durations.
 */
public void clear() {
  histogram.clear();
}

代码示例来源:origin: io.netty/netty-metrics-yammer

@Override
public void reset() {
  delegate.clear();
}

代码示例来源:origin: com.wavefront/proxy

@Override
 public Double value() {
  Double maxValue = receivedBurstRateHistogram.max();
  receivedBurstRateHistogram.clear();
  return maxValue;
 }
});

代码示例来源:origin: wavefrontHQ/java

@Override
 public Double value() {
  Double maxValue = receivedBurstRateHistogram.max();
  receivedBurstRateHistogram.clear();
  return maxValue;
 }
});

代码示例来源:origin: wavefrontHQ/java

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();
}

代码示例来源:origin: com.wavefront/java-lib

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();
}

代码示例来源:origin: wavefrontHQ/java

@Override
public void processHistogram(MetricName name, Histogram histogram, Void context) throws Exception {
 if (histogram instanceof WavefrontHistogram) {
  WavefrontHistogram wavefrontHistogram = (WavefrontHistogram) histogram;
  List<WavefrontHistogram.MinuteBin> bins = wavefrontHistogram.bins(clear);
  if (bins.isEmpty()) return; // don't send empty histograms.
  for (WavefrontHistogram.MinuteBin minuteBin : bins) {
   StringBuilder sb = new StringBuilder();
   sb.append("!M ").append(minuteBin.getMinMillis() / 1000);
   for (Centroid c : minuteBin.getDist().centroids()) {
    sb.append(" #").append(c.count()).append(" ").append(c.mean());
   }
   sb.append(" \"").append(getName(name)).append("\"").append(tagsForMetricName(name)).append("\n");
   histogramsSocket.write(sb.toString());
  }
 } else {
  if (!sendEmptyHistograms && histogram.count() == 0) {
   // send count still but skip the others.
   writeMetric(name, "count", 0);
  } else {
   writeMetric(name, "count", histogram.count());
   writeSampling(name, histogram);
   writeSummarizable(name, histogram);
   if (clear) histogram.clear();
  }
 }
}

代码示例来源:origin: wavefrontHQ/java

@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();
}

代码示例来源:origin: com.wavefront/proxy

@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();
}

相关文章