当前位置: 首页>>代码示例>>Java>>正文


Java Metered类代码示例

本文整理汇总了Java中com.codahale.metrics.Metered的典型用法代码示例。如果您正苦于以下问题:Java Metered类的具体用法?Java Metered怎么用?Java Metered使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Metered类属于com.codahale.metrics包,在下文中一共展示了Metered类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reportMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void reportMetered(String name, Metered meter, long timestamp, List<String> tags)
    throws IOException {
  if (expansions.contains(Expansion.COUNT)) {
    request.addGauge(new CirconusGauge(
        appendExpansionSuffix(name, Expansion.COUNT),
        meter.getCount(),
        timestamp,
        host,
        tags));
  }

  double[] values = { meter.getOneMinuteRate(), meter.getFiveMinuteRate(),
      meter.getFifteenMinuteRate(), meter.getMeanRate() };

  for (int i = 0; i < RATE_EXPANSIONS.length; i++) {
    if (expansions.contains(RATE_EXPANSIONS[i])) {
      request.addGauge(new CirconusGauge(
          appendExpansionSuffix(name, RATE_EXPANSIONS[i]),
          toNumber(convertRate(values[i])),
          timestamp,
          host,
          tags));
    }
  }
}
 
开发者ID:circonus-labs,项目名称:metrics-circonus,代码行数:26,代码来源:CirconusReporter.java

示例2: reportMeter

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void reportMeter(String name, Metered meter, long now) {
    if (canSkipMetric(name, meter)) {
        return;
    }
    Map<String, Object> fields = new HashMap<String, Object>();
    fields.put("count", meter.getCount());
    fields.put("m1_rate", convertRate(meter.getOneMinuteRate()));
    fields.put("m5_rate", convertRate(meter.getFiveMinuteRate()));
    fields.put("m15_rate", convertRate(meter.getFifteenMinuteRate()));
    fields.put("mean_rate", convertRate(meter.getMeanRate()));

    if (includeMeterFields != null) {
        fields.keySet().retainAll(includeMeterFields);
    }

    influxDb.appendPoints(
        new InfluxDbPoint(
            getMeasurementName(name),
            getTags(name),
            now,
            fields));
}
 
开发者ID:iZettle,项目名称:dropwizard-metrics-influxdb,代码行数:23,代码来源:InfluxDbReporter.java

示例3: reportMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void reportMetered(MetricContext context, String name, Metered metered, long timeStamp)
    throws IOException {
  this.graphiteSender.send(
      MetricRegistry.name(context.getName(), name, Measurements.COUNT.getName()),
      Long.toString(metered.getCount()),
      timeStamp);
  this.graphiteSender.send(
      MetricRegistry.name(context.getName(), name, Measurements.RATE_1MIN.getName()),
      Double.toHexString(convertRate(metered.getOneMinuteRate())),
      timeStamp);
  this.graphiteSender.send(
      MetricRegistry.name(context.getName(), name, Measurements.RATE_5MIN.getName()),
      Double.toString(convertRate(metered.getFiveMinuteRate())),
      timeStamp);
  this.graphiteSender.send(
      MetricRegistry.name(context.getName(), name, Measurements.RATE_15MIN.getName()),
      Double.toString(convertRate(metered.getFifteenMinuteRate())),
      timeStamp);
  this.graphiteSender.send(
      MetricRegistry.name(context.getName(), name, Measurements.MEAN_RATE.getName()),
      Double.toString(convertRate(metered.getMeanRate())),
      timeStamp);
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:24,代码来源:GraphiteReporter.java

示例4: reportMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void reportMetered(String index, long timestamp, String name,
        Metered meter) throws IOException {
    StringWriter writer = new StringWriter();
    JsonGenerator jsonGenerator = jsonFactory.createGenerator(writer);
    jsonGenerator.writeStartObject();
    jsonGenerator.writeNumberField(timestampFieldName, timestamp);
    jsonGenerator.writeStringField("@name", prefixMetricName(name));

    jsonGenerator.writeNumberField("count", meter.getCount());
    jsonGenerator.writeNumberField("m1_rate",
            convertRate(meter.getOneMinuteRate()));
    jsonGenerator.writeNumberField("m5_rate",
            convertRate(meter.getFiveMinuteRate()));
    jsonGenerator.writeNumberField("m15_rate",
            convertRate(meter.getFifteenMinuteRate()));
    jsonGenerator.writeNumberField("mean_rate",
            convertRate(meter.getMeanRate()));

    jsonGenerator.writeEndObject();
    jsonGenerator.flush();
    addReportToBulkRequest(index, MetricElasticsearchTypes.METER,
            writer.toString());
}
 
开发者ID:tomcashman,项目名称:metrics-elasticsearch,代码行数:24,代码来源:ElasticsearchReporter.java

示例5: addMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
void addMetered(String baseName, Metered metered) {
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.COUNT,
            SignalFxProtocolBuffers.MetricType.CUMULATIVE_COUNTER, metered.getCount());
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_15_MIN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.getFifteenMinuteRate());
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_1_MIN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.getOneMinuteRate());
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_5_MIN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.getFiveMinuteRate());

    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_MEAN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.getMeanRate());
}
 
开发者ID:signalfx,项目名称:signalfx-java,代码行数:19,代码来源:AggregateMetricSenderSessionWrapper.java

示例6: printMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void printMetered(TagEncodedMetricName metric, Metered meter) {
  addDataPoint(metric.submetric("rate").withTags("window", "1m"),
      convertRate(meter.getOneMinuteRate()));
  addDataPoint(metric.submetric("rate").withTags("window", "5m"),
      convertRate(meter.getFiveMinuteRate()));
  addDataPoint(metric.submetric("rate").withTags("window", "15m"),
      convertRate(meter.getFifteenMinuteRate()));
  //addDataPoint(rootMetric.submetric("rate", "window", "all"), epoch, meter.getMeanRate());
}
 
开发者ID:ApptuitAI,项目名称:JInsight,代码行数:10,代码来源:ApptuitReporter.java

示例7: writeMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void writeMetered(String dropwizardName, Metered metered) throws IOException {
    String name = sanitizeMetricName(dropwizardName);
    writer.writeSample(name, mapOf("rate", "m1"), metered.getOneMinuteRate());
    writer.writeSample(name, mapOf("rate", "m5"), metered.getFiveMinuteRate());
    writer.writeSample(name, mapOf("rate", "m15"), metered.getFifteenMinuteRate());
    writer.writeSample(name, mapOf("rate", "mean"), metered.getMeanRate());
}
 
开发者ID:dhatim,项目名称:dropwizard-prometheus,代码行数:8,代码来源:DropwizardMetricsExporter.java

示例8: reportMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void reportMetered(
    final BatchBuilder builder, final Metered value
) {
    final BatchBuilder b = builder.withUnit(builder.getUnit() + "/s");

    b.buildPoint("1m", value.getOneMinuteRate());
    b.buildPoint("5m", value.getFiveMinuteRate());
}
 
开发者ID:spotify,项目名称:semantic-metrics,代码行数:9,代码来源:FastForwardHttpReporter.java

示例9: MeteredEntity

import com.codahale.metrics.Metered; //导入依赖的package包/类
public MeteredEntity(final Metered meter) {
    count = meter.getCount();
    m1Rate = meter.getOneMinuteRate();
    m5Rate = meter.getFiveMinuteRate();
    m15Rate = meter.getFifteenMinuteRate();
    meanRate = meter.getMeanRate();
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:8,代码来源:MeteredEntity.java

示例10: reportMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void reportMetered(String name, Metered meter) throws IOException {
    statsdClient.send(prefix(name, "count"), format(meter.getCount()), StatsdClient.StatType.GAUGE);

    statsdClient.send(prefix(name, "mean_rate"),
            format(convertRate(meter.getMeanRate())),
            StatsdClient.StatType.TIMER);
}
 
开发者ID:Microsoft,项目名称:Availability-Monitor-for-Kafka,代码行数:8,代码来源:StatsdReporter.java

示例11: formatMetered

import com.codahale.metrics.Metered; //导入依赖的package包/类
private String formatMetered(String name, Metered meter, long timestamp) {
    StringBuilder outputBuilder = new StringBuilder();

    outputBuilder.append(formatLine(MetricNamingUtil.join(name, "count"), meter.getCount(), timestamp));
    outputBuilder.append(formatLine(MetricNamingUtil.join(name, "m1_rate"), convertRate(meter.getOneMinuteRate()), timestamp));
    outputBuilder.append(formatLine(MetricNamingUtil.join(name, "m5_rate"), convertRate(meter.getFiveMinuteRate()), timestamp));
    outputBuilder.append(formatLine(MetricNamingUtil.join(name, "m15_rate"), convertRate(meter.getFifteenMinuteRate()), timestamp));
    outputBuilder.append(formatLine(MetricNamingUtil.join(name, "mean_rate"), convertRate(meter.getMeanRate()), timestamp));

    return outputBuilder.toString();
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:12,代码来源:GraphiteMetricFormatter.java

示例12: registerHealthCheck

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void registerHealthCheck(String name, Optional<Double> ceiling, Metered errorMeter, Metered timer) {
    final Gauge<Double> errorRate = Gauges.ratioOf(errorMeter, timer, Metered::getFifteenMinuteRate);

    final HealthCheck healthCheck = HealthChecks.forDoubleGauge(
            errorRate,
            ceiling
    );

    healthCheckRegistry.register(name, healthCheck);
}
 
开发者ID:sproutsocial,项目名称:instrumentor,代码行数:11,代码来源:Instrumentor.java

示例13: registerErrorGauges

import com.codahale.metrics.Metered; //导入依赖的package包/类
private void registerErrorGauges(String name, Meter errorMeter, Timer timer) {
    final Gauge<Double> totalErrorPct = Gauges.ratioOf(errorMeter, timer, m -> Long.valueOf(m.getCount()).doubleValue());
    final Gauge<Double> meanErrorPct = Gauges.ratioOf(errorMeter, timer, Metered::getMeanRate);
    final Gauge<Double> m1ErrorPct = Gauges.ratioOf(errorMeter, timer, Metered::getOneMinuteRate);
    final Gauge<Double> m5ErrorPct = Gauges.ratioOf(errorMeter, timer, Metered::getFiveMinuteRate);
    final Gauge<Double> m15ErrorPct = Gauges.ratioOf(errorMeter, timer, Metered::getFifteenMinuteRate);

    tryRegister(totalErrorPct, MetricRegistry.name(name, "errors", "total_pct"));
    tryRegister(meanErrorPct, MetricRegistry.name(name, "errors", "mean_pct"));
    tryRegister(m1ErrorPct, MetricRegistry.name(name, "errors", "m1_pct"));
    tryRegister(m5ErrorPct, MetricRegistry.name(name, "errors", "m5_pct"));
    tryRegister(m15ErrorPct, MetricRegistry.name(name, "errors", "m15_pct"));
}
 
开发者ID:sproutsocial,项目名称:instrumentor,代码行数:14,代码来源:Instrumentor.java

示例14: ratioOf

import com.codahale.metrics.Metered; //导入依赖的package包/类
public static MeteredRatioGauge ratioOf(
        Metered numerator,
        Metered denominator,
        Function<Metered, Double> accessor
) {
    return new MeteredRatioGauge(numerator, denominator, accessor);
}
 
开发者ID:sproutsocial,项目名称:instrumentor,代码行数:8,代码来源:Gauges.java

示例15: testOverrideAccessor

import com.codahale.metrics.Metered; //导入依赖的package包/类
@Test
public void testOverrideAccessor() throws Exception {

    when(numerator.getFifteenMinuteRate()).thenReturn(10d);
    when(denominator.getFifteenMinuteRate()).thenReturn(100d);

    Gauge<Double> gauge = Gauges.ratioOf(
            numerator,
            denominator,
            Metered::getFifteenMinuteRate
    );

    assertEquals((Double) 0.1d, gauge.getValue());
}
 
开发者ID:sproutsocial,项目名称:instrumentor,代码行数:15,代码来源:MeteredRatioGaugeTest.java


注:本文中的com.codahale.metrics.Metered类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。