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


Java Metered类代码示例

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


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

示例1: processMeter

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
@Override
public void processMeter(MetricName metricName, Metered metered, Context context) throws Exception {
  if (MetricsUtils.isInterested(metricName)) {
    double value;
    if (context.reportingInterval() <= 60000L) {
      value = metered.oneMinuteRate();
    } else if (context.reportingInterval() <= 300000) {
      value = metered.fiveMinuteRate();
    } else {
      value = metered.fifteenMinuteRate();
    }
    CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(),
                                                                 context.brokerId(),
                                                                 metricName,
                                                                 value);
    context.reporter().sendCruiseControlMetric(ccm);
  }
}
 
开发者ID:linkedin,项目名称:cruise-control,代码行数:19,代码来源:YammerMetricProcessor.java

示例2: processMeter

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void processMeter(final MetricName name, final Metered meter, final Map context) throws Exception {

  final Map subMetrics =
          ImmutableMap
                  .builder()
                  .put("count", meter.count())
                  .put("meanRate", meter.meanRate())
                  .put("1MinuteRate", meter.oneMinuteRate())
                  .put("5MinuteRate", meter.fiveMinuteRate())
                  .put("15MinuteRate", meter.fifteenMinuteRate())
                  .build();

  context.put(toString(name), subMetrics);
}
 
开发者ID:staslev,项目名称:storm-metrics-reporter,代码行数:17,代码来源:YammerFacadeMetric.java

示例3: addMetered

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
/**
 * Add Metered metric
 * @param baseName
 * @param metered
 */

void addMetered(MetricName baseName, Metered metered) {
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.COUNT,
            SignalFxProtocolBuffers.MetricType.CUMULATIVE_COUNTER, metered.count());
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_15_MIN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.fifteenMinuteRate());
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_1_MIN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.oneMinuteRate());
    addMetric(metered, baseName,
            SignalFxReporter.MetricDetails.RATE_5_MIN,
            SignalFxProtocolBuffers.MetricType.GAUGE, metered.fiveMinuteRate());

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

示例4: processAll

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
/**
 * @param metrics The metrics you want to process
 * @return A string of table rows.
 */
public String processAll(Map<MetricName, Metric> metrics) {
	StringBuilder sb = new StringBuilder();
	for (Entry<MetricName, Metric> metric : metrics.entrySet()) {
		if (metric.getValue() instanceof Metered) {
			if (metric.getValue() instanceof Timer) {
				processTimer(metric.getKey(), (Timer) metric.getValue(), sb);
			} else {
				processMeter(metric.getKey(), (Metered) metric.getValue(), sb);
			}
		} else if (metric.getValue() instanceof Counter) {
			processCounter(metric.getKey(), (Counter) metric.getValue(), sb);
		} else if (metric.getValue() instanceof Histogram) {
			processHistogram(metric.getKey(), (Histogram) metric.getValue(), sb);
		} else if (metric.getValue() instanceof Gauge) {
			processGauge(metric.getKey(), (Gauge<?>) metric.getValue(), sb);
		} else {
			throw new IllegalStateException("Unknown metric " + metric);
		}
	}
	return sb.toString();
}
 
开发者ID:devhub-tud,项目名称:devhub-prototype,代码行数:26,代码来源:HtmlMetricProcessor.java

示例5: processMeter

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
@Override
public void processMeter(final MetricName name, final Metered meter,
        final PrintStream stream) {
    final String unit = abbrev(meter.rateUnit());
    stream.printf(locale, "             count = %,d\n", meter.count());
    stream.printf(locale, "         mean rate = %,2.2f %s/%s\n",
            meter.meanRate(), meter.eventType(), unit);
    stream.printf(locale, "     1-minute rate = %,2.2f %s/%s\n",
            meter.oneMinuteRate(), meter.eventType(), unit);
    stream.printf(locale, "     5-minute rate = %,2.2f %s/%s\n",
            meter.fiveMinuteRate(), meter.eventType(), unit);
    stream.printf(locale, "    15-minute rate = %,2.2f %s/%s\n",
            meter.fifteenMinuteRate(), meter.eventType(), unit);
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:15,代码来源:CustomReporter.java

示例6: awaitCount

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
private void awaitCount(int expectedValue, Metered timer) throws InterruptedException {
  final int timeout = 10;
  final long t1 = System.currentTimeMillis();
  while (expectedValue != timer.count()) {
    if (System.currentTimeMillis() - t1 > timeout) {
      assertEquals(expectedValue, timer.count());
      return;
    }
    Thread.sleep(0, 100);
  }
}
 
开发者ID:spotify,项目名称:folsom,代码行数:12,代码来源:YammerMetricsTest.java

示例7: processMeter

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
@Override
public void processMeter(MetricName name, Metered meter, Long epoch) throws Exception {
    final String sanitizedName = sanitizeName(name);
    sendInt(sanitizedName + ".count", StatType.GAUGE, meter.count());
    sendFloat(sanitizedName + ".meanRate", StatType.TIMER, meter.meanRate());
    sendFloat(sanitizedName + ".1MinuteRate", StatType.TIMER, meter.oneMinuteRate());
    sendFloat(sanitizedName + ".5MinuteRate", StatType.TIMER, meter.fiveMinuteRate());
    sendFloat(sanitizedName + ".15MinuteRate", StatType.TIMER, meter.fifteenMinuteRate());
}
 
开发者ID:krux,项目名称:kafka-metrics-reporter,代码行数:10,代码来源:StatsdReporter.java

示例8: setupMeteredMock

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
static void setupMeteredMock(Metered metered) {
  when(metered.count()).thenReturn(1L);
  when(metered.oneMinuteRate()).thenReturn(1d);
  when(metered.fiveMinuteRate()).thenReturn(5d);
  when(metered.fifteenMinuteRate()).thenReturn(15d);
  when(metered.meanRate()).thenReturn(2d);
  when(metered.eventType()).thenReturn("eventType");
  when(metered.rateUnit()).thenReturn(TimeUnit.SECONDS);
}
 
开发者ID:airbnb,项目名称:kafka-statsd-metrics2,代码行数:10,代码来源:StatsDReporterTest.java

示例9: addMeter

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
private void addMeter(org.apache.blur.thrift.generated.Metric metric, Metered meter,
    ConcurrentMap<String, org.apache.blur.thrift.generated.Metric> context) {
  metric.putToStrMap("rateUnit", meter.rateUnit().toString());
  metric.putToStrMap("eventType", meter.eventType());
  metric.putToLongMap("count", meter.count());
  metric.putToDoubleMap("meanRate", meter.meanRate());
  metric.putToDoubleMap("oneMinuteRate", meter.oneMinuteRate());
  metric.putToDoubleMap("fiveMinuteRate", meter.fiveMinuteRate());
  metric.putToDoubleMap("fifteenMinuteRate", meter.fifteenMinuteRate());
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:11,代码来源:MemoryReporter.java

示例10: addMeterInfo

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
private void addMeterInfo(Long time, Metered meter, MetricInfo info) {
  info.addNumber("timestamp", time);
  info.setMetaData("rateUnit", meter.rateUnit().toString());
  info.setMetaData("eventType", meter.eventType());
  info.addNumber("count", meter.count());
  info.addNumber("meanRate", meter.meanRate());
  info.addNumber("oneMinuteRate", meter.oneMinuteRate());
  info.addNumber("fiveMinuteRate", meter.fiveMinuteRate());
  info.addNumber("fifteenMinuteRate", meter.fifteenMinuteRate());
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:11,代码来源:JSONReporter.java

示例11: processMeter

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
public void processMeter(MetricName name, Metered meter, PrintStream stream) {
	 
	 stream.append(TABLE_BEGIN);
	 header(name.getName(), stream);
	 meterRows(meter, stream);
	 stream.append(TABLE_END);
	 meterGraph(name, meter, stream);
}
 
开发者ID:philipgloyne,项目名称:metrics-dashboard,代码行数:9,代码来源:HtmlReporter.java

示例12: meterRows

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
private void meterRows(Metered meter, PrintStream stream) {
	String rate = abbrev(meter.rateUnit());
	stream.printf("<tr><td>count</td><td>%d</td></tr>", meter.count());
	stream.printf("<tr><td>mean rate</td><td>%2.2f/%s</td></tr>", meter.meanRate(), rate);
	stream.printf("<tr><td>1-minute rate</td><td>%2.2f/%s</td></tr>", meter.oneMinuteRate(), rate);
	stream.printf("<tr><td>5-minute rate</td><td>%2.2f/%s</td></tr>", meter.fiveMinuteRate(), rate);
	stream.printf("<tr><td>15-minute rate</td><td>%2.2f/%s</td></tr>", meter.fifteenMinuteRate(), rate);
}
 
开发者ID:philipgloyne,项目名称:metrics-dashboard,代码行数:9,代码来源:HtmlReporter.java

示例13: meterGraph

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
private void meterGraph(MetricName name, Metered meter, PrintStream stream) {
GraphData<Metered> graphData = GraphData.meteredGraphData(name, maxItems);
graphData.addItem(meter);

stream.append("<div class=\"span8 chart\"");
stream.printf(" id=\"chart-%s-meter\"", name.hashCode());
stream.append(" style=\"height:420px;width:620px;\"");
stream.printf(" data=\"%s\"", graphData.data());
stream.append(" name=\"rate\" labels=\"['mean', '1-minute', '5-minute', '15-minute']\"" );
stream.append("></div>");
	 
 }
 
开发者ID:philipgloyne,项目名称:metrics-dashboard,代码行数:13,代码来源:HtmlReporter.java

示例14: addItem

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
@Override
public void addItem(Metered metric) {
	queue.put(System.currentTimeMillis(), new Data(metric.meanRate(), metric.oneMinuteRate(), metric.fiveMinuteRate(), metric.fifteenMinuteRate()));
	if (queue.size() > maxItems) {
		queue.remove(queue.firstKey());
	}	
}
 
开发者ID:philipgloyne,项目名称:metrics-dashboard,代码行数:8,代码来源:MeterGraphData.java

示例15: meteredGraphData

import com.yammer.metrics.core.Metered; //导入依赖的package包/类
public static GraphData<Metered> meteredGraphData(MetricName name, int maxItems) {
	GraphData<Metered> data = MeteredQueues.get(name);
	if (data == null) {
		data = new MeterGraphData(maxItems);
		MeteredQueues.put(name, data);
	}
	return data;
}
 
开发者ID:philipgloyne,项目名称:metrics-dashboard,代码行数:9,代码来源:GraphData.java


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