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

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

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

Histogram.max介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-pinot

Histogram h = (Histogram) hist;
_min = Math.min(_min, h.min());
_max = Math.max(_max, h.max());
_sum += h.sum();
meanSum += h.mean();

代码示例来源:origin: linkedin/cruise-control

context.brokerId(),
                               metricName,
                               histogram.max(),
                               MetricsUtils.ATTRIBUTE_MAX);
context.reporter().sendCruiseControlMetric(ccm);

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

@Override
public double getMax() {
  return metric.max();
}

代码示例来源:origin: harbby/presto-connectors

public double getMax() {
 return ageHistogram.max();
}

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

/**
 * Returns the longest recorded duration.
 *
 * @return the longest recorded duration
 */
@Override
public double max() {
  return convertFromNS(histogram.max());
}

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

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

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

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

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

@Override
public void processHistogram(MetricName name, Histogram histogram, Context context) throws IOException {
  final PrintStream stream = context.getStream("# time,min,max,mean,median,stddev,95%,99%,99.9%");
  final Snapshot snapshot = histogram.getSnapshot();
  stream.append(new StringBuilder()
             .append(histogram.min()).append(',')
             .append(histogram.max()).append(',')
             .append(histogram.mean()).append(',')
             .append(snapshot.getMedian()).append(',')
             .append(histogram.stdDev()).append(',')
             .append(snapshot.get95thPercentile()).append(',')
             .append(snapshot.get99thPercentile()).append(',')
             .append(snapshot.get999thPercentile()).toString())
      .println();
  stream.println();
  stream.flush();
}

代码示例来源:origin: harbby/presto-connectors

/** @return an abbreviated summary of {@code hist}. */
public static String getShortHistogramReport(final Histogram hist) {
 Snapshot sn = hist.getSnapshot();
 return "mean=" + DOUBLE_FORMAT.format(hist.mean()) +
   ", min=" + DOUBLE_FORMAT.format(hist.min()) +
   ", max=" + DOUBLE_FORMAT.format(hist.max()) +
   ", stdDev=" + DOUBLE_FORMAT.format(hist.stdDev()) +
   ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
   ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile());
}

代码示例来源:origin: addthis/hydra

builder.append("\n");
builder.append("max: ");
builder.append(histogram.max());
builder.append("\n");
builder.append("mean: ");

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

@Override
public void processHistogram(MetricName name, Histogram histogram, 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());
}

代码示例来源:origin: addthis/hydra

String slowHost = "";
for (Map.Entry<String, Histogram> entry : responseTimeMap.entrySet()) {
  log.trace("hostTime: " + entry.getKey() + " - " + entry.getValue().max());
  if (entry.getValue().max() > max) {
    slowHost = entry.getKey() + " - " + entry.getValue().max();
    max = entry.getValue().max();

代码示例来源:origin: amient/kafka-metrics

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

代码示例来源:origin: harbby/presto-connectors

/** @return a summary of {@code hist}. */
 public static String getHistogramReport(final Histogram hist) {
  Snapshot sn = hist.getSnapshot();
  return ", mean=" + DOUBLE_FORMAT.format(hist.mean()) +
    ", min=" + DOUBLE_FORMAT.format(hist.min()) +
    ", max=" + DOUBLE_FORMAT.format(hist.max()) +
    ", stdDev=" + DOUBLE_FORMAT.format(hist.stdDev()) +
    ", 50th=" + DOUBLE_FORMAT.format(sn.getMedian()) +
    ", 75th=" + DOUBLE_FORMAT.format(sn.get75thPercentile()) +
    ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
    ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile()) +
    ", 99.9th=" + DOUBLE_FORMAT.format(sn.get999thPercentile()) +
    ", 99.99th=" + DOUBLE_FORMAT.format(sn.getValue(0.9999)) +
    ", 99.999th=" + DOUBLE_FORMAT.format(sn.getValue(0.99999));
 }
}

代码示例来源:origin: addthis/metrics-reporter-config

private void addSnapshotDataObject(MetricName key, Histogram histogram, List<DataObject> dataObjectList) {
  Snapshot snapshot = histogram.getSnapshot();
  dataObjectList.add(toDataObject(key, ".min", histogram.min()));
  dataObjectList.add(toDataObject(key, ".max", histogram.max()));
  dataObjectList.add(toDataObject(key, ".mean", histogram.mean()));
  dataObjectList.add(toDataObject(key, ".stddev", histogram.stdDev()));
  dataObjectList.add(toDataObject(key, ".median", snapshot.getMedian()));
  dataObjectList.add(toDataObject(key, ".75th", snapshot.get75thPercentile()));
  dataObjectList.add(toDataObject(key, ".95th", snapshot.get95thPercentile()));
  dataObjectList.add(toDataObject(key, ".98th", snapshot.get98thPercentile()));
  dataObjectList.add(toDataObject(key, ".99th", snapshot.get99thPercentile()));
  dataObjectList.add(toDataObject(key, ".99.9th", snapshot.get999thPercentile()));
}

代码示例来源:origin: harbby/presto-connectors

@Override
 public String toString() {
  Snapshot snapshot = this.age.getSnapshot();
  return "count=" + count + ", dataBlockCount=" + this.dataBlockCount + ", size=" + size +
    ", dataSize=" + getDataSize() +
    ", mean age=" + this.age.mean() + ", stddev age=" + this.age.stdDev() +
    ", min age=" + this.age.min() + ", max age=" + this.age.max() +
    ", 95th percentile age=" + snapshot.get95thPercentile() +
    ", 99th percentile age=" + snapshot.get99thPercentile();
 }
}

代码示例来源:origin: addthis/hydra

@Test
public void reportsHistogramValues() throws Exception {
  final Histogram histogram = mock(Histogram.class);
  when(histogram.count()).thenReturn(1L);
  when(histogram.max()).thenReturn(2.0);
  when(histogram.mean()).thenReturn(3.0);
  when(histogram.min()).thenReturn(4.0);
  when(histogram.stdDev()).thenReturn(5.0);
  final Snapshot snapshot = mock(Snapshot.class);
  when(snapshot.getMedian()).thenReturn(6.0);
  when(snapshot.get75thPercentile()).thenReturn(7.0);
  when(snapshot.get95thPercentile()).thenReturn(8.0);
  when(snapshot.get98thPercentile()).thenReturn(9.0);
  when(snapshot.get99thPercentile()).thenReturn(10.0);
  when(snapshot.get999thPercentile()).thenReturn(11.0);
  when(histogram.getSnapshot()).thenReturn(snapshot);
  reporter.processHistogram(name("histogram"), histogram, null);
  verify(output).send(decode("name = t.test.histogram.max, value = 2, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.mean, value = 3.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.min, value = 4, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.stddev, value = 5.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.median, value = 6.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.75percentile, value = 7.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.95percentile, value = 8.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.98percentile, value = 9.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.99percentile, value = 10.0, group = histo, units = \"\""));
  verify(output).send(decode("name = t.test.histogram.999percentile, value = 11.0, group = histo, units = \"\""));
}

代码示例来源:origin: addthis/MetricCatcher

@Test
public void testRun_MultipleUpdatePackets_Histograms() throws IOException, InterruptedException {
  String json;
  byte[] jsonBytes;
  double minVal = 2;
  double maxVal = 7;
  long timestamp = System.currentTimeMillis() / 1000L;
  json = "[" +
        "{\"name\":\"" + metricName +
        "\",\"value\":" + maxVal + "," +
        "\"type\":\"biased\"," +
        "\"timestamp\":" + timestamp++ + "}" +
      "]";
  jsonBytes = json.getBytes();
  sendingSocket.send(new DatagramPacket(jsonBytes, jsonBytes.length, localhost, listeningSocket.getLocalPort()));
  json = "[" +
        "{\"name\":\"" + metricName +
        "\",\"value\":" + minVal + "," +
        "\"type\":\"biased\"," +
        "\"timestamp\":" + timestamp++ + "}" +
      "]";
  jsonBytes = json.getBytes();
  sendingSocket.send(new DatagramPacket(jsonBytes, jsonBytes.length, localhost, listeningSocket.getLocalPort()));
  metricCatcher.start();
  Thread.sleep(500);
  metricCatcher.shutdown();
  assertEquals(2, ((Histogram) metricCache.get(metricName)).count());
  assertEquals(minVal, ((Histogram) metricCache.get(metricName)).min(), 0);
  assertEquals(maxVal, ((Histogram) metricCache.get(metricName)).max(), 0);
}

代码示例来源:origin: com.linkedin.cruisecontrol/cruise-control-metrics-reporter

context.brokerId(),
                               metricName,
                               histogram.max(),
                               MetricsUtils.ATTRIBUTE_MAX);
context.reporter().sendCruiseControlMetric(ccm);

代码示例来源:origin: addthis/hydra

@Override
public void processHistogram(MetricName name, Histogram histogram, String x) throws IOException {
  final String sanitizedName = sanitizeName(name);
  final Snapshot snapshot = histogram.getSnapshot();
  printDoubleField(sanitizedName + ".min", histogram.min(), "histo");
  printDoubleField(sanitizedName + ".max", histogram.max(), "histo");
  printDoubleField(sanitizedName + ".mean", histogram.mean(), "histo");
  printDoubleField(sanitizedName + ".stddev", histogram.stdDev(), "histo");
  printDoubleField(sanitizedName + ".median", snapshot.getMedian(), "histo");
  printDoubleField(sanitizedName + ".75percentile", snapshot.get75thPercentile(), "histo");
  printDoubleField(sanitizedName + ".95percentile", snapshot.get95thPercentile(), "histo");
  printDoubleField(sanitizedName + ".98percentile", snapshot.get98thPercentile(), "histo");
  printDoubleField(sanitizedName + ".99percentile", snapshot.get99thPercentile(), "histo");
  printDoubleField(sanitizedName + ".999percentile", snapshot.get999thPercentile(), "histo");
}

相关文章