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

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(149)

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

Timer.getSnapshot介绍

暂无

代码示例

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

context.reporter().sendCruiseControlMetric(ccm);
Snapshot snapshot = timer.getSnapshot();

代码示例来源:origin: urbanairship/statshtable

@Override
public Snapshot getSnapshot() {
  return t.getSnapshot();
}

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

@Override
public double get999thPercentile() {
  return metric.getSnapshot().get999thPercentile();
}

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

@Override
  public double[] values() {
    return metric.getSnapshot().getValues();
  }
}

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

@Override
public double get75thPercentile() {
  return metric.getSnapshot().get75thPercentile();
}

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

@Override
public double get98thPercentile() {
  return metric.getSnapshot().get98thPercentile();
}

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

@Override
public double get99thPercentile() {
  return metric.getSnapshot().get99thPercentile();
}

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

@Override
public double get50thPercentile() {
  return metric.getSnapshot().getMedian();
}

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

@Override
public double get95thPercentile() {
  return metric.getSnapshot().get95thPercentile();
}

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

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

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

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

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

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

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

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

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

@Override
public void processTimer(MetricName name, Timer timer, 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);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public void run()
  {
    SpeculativeRetry retryPolicy = ColumnFamilyStore.this.metadata.getSpeculativeRetry();
    switch (retryPolicy.type)
    {
      case PERCENTILE:
        // get percentile in nanos
        assert metric.coordinatorReadLatency.durationUnit() == TimeUnit.MICROSECONDS;
        sampleLatencyNanos = (long) (metric.coordinatorReadLatency.getSnapshot().getValue(retryPolicy.value) * 1000d);
        break;
      case CUSTOM:
        // convert to nanos, since configuration is in millisecond
        sampleLatencyNanos = (long) (retryPolicy.value * 1000d * 1000d);
        break;
      default:
        sampleLatencyNanos = Long.MAX_VALUE;
        break;
    }
  }
}, DatabaseDescriptor.getReadRpcTimeout(), DatabaseDescriptor.getReadRpcTimeout(), TimeUnit.MILLISECONDS);

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

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

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

when(snapshot.get999thPercentile()).thenReturn((double) 1000);
when(timer.getSnapshot()).thenReturn(snapshot);

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

context.reporter().sendCruiseControlMetric(ccm);
Snapshot snapshot = timer.getSnapshot();

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

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

相关文章