本文整理了Java中com.yammer.metrics.core.MetricsRegistry.newCounter()
方法的一些代码示例,展示了MetricsRegistry.newCounter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetricsRegistry.newCounter()
方法的具体详情如下:
包路径:com.yammer.metrics.core.MetricsRegistry
类名称:MetricsRegistry
方法名:newCounter
[英]Creates a new Counter and registers it under the given metric name.
[中]创建一个新计数器,并将其注册到给定的度量名称下。
代码示例来源:origin: apache/incubator-pinot
/**
*
* Return an existing counter if
* (a) A counter already exist with the same metric name.
* Otherwise, creates a new meter and registers
*
* @param registry MetricsRegistry
* @param name metric name
* @return Counter
*/
public static Counter newCounter(MetricsRegistry registry, MetricName name) {
if (registry != null) {
return registry.newCounter(name);
} else {
return Metrics.newCounter(name);
}
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* Creates a new {@link com.yammer.metrics.core.Counter} and registers it under the given class
* and name.
*
* @param klass the class which owns the metric
* @param name the name of the metric
* @return a new {@link com.yammer.metrics.core.Counter}
*/
public static Counter newCounter(Class<?> klass, String name) {
return DEFAULT_REGISTRY.newCounter(klass, name);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* Creates a new {@link com.yammer.metrics.core.Counter} and registers it under the given metric
* name.
*
* @param metricName the name of the metric
* @return a new {@link com.yammer.metrics.core.Counter}
*/
public static Counter newCounter(MetricName metricName) {
return DEFAULT_REGISTRY.newCounter(metricName);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* Creates a new {@link Counter} and registers it under the given class and name.
*
* @param klass the class which owns the metric
* @param name the name of the metric
* @return a new {@link Counter}
*/
public Counter newCounter(Class<?> klass,
String name) {
return newCounter(klass, name, null);
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* Creates a new {@link com.yammer.metrics.core.Counter} and registers it under the given class
* and name.
*
* @param klass the class which owns the metric
* @param name the name of the metric
* @param scope the scope of the metric
* @return a new {@link com.yammer.metrics.core.Counter}
*/
public static Counter newCounter(Class<?> klass,
String name,
String scope) {
return DEFAULT_REGISTRY.newCounter(klass, name, scope);
}
代码示例来源:origin: harbby/presto-connectors
public RunnerStats(MetricsRegistry registry) {
this.normalRunners = registry.newCounter(MetricsConnection.class, "normalRunnersCount");
this.delayRunners = registry.newCounter(MetricsConnection.class, "delayRunnersCount");
this.delayIntevalHist = registry.newHistogram(MetricsConnection.class, "delayIntervalHist");
}
代码示例来源:origin: com.yammer.metrics/metrics-core
/**
* Creates a new {@link Counter} and registers it under the given class and name.
*
* @param klass the class which owns the metric
* @param name the name of the metric
* @param scope the scope of the metric
* @return a new {@link Counter}
*/
public Counter newCounter(Class<?> klass,
String name,
String scope) {
return newCounter(createName(klass, name, scope));
}
代码示例来源:origin: org.apache.giraph/giraph-core
/**
* Creates a new {@link com.yammer.metrics.core.Counter} and registers it
* under the given group and name.
*
* @param name the name of the metric
* @return a new {@link com.yammer.metrics.core.Counter}
*/
public Counter getCounter(String name) {
return registry.newCounter(makeMetricName(name));
}
代码示例来源:origin: io.netty/netty-metrics-yammer
/**
* Create a new {@link CounterMonitor} that is backed by a {@code Yammer}
* {@link Counter}.
* @see MonitorRegistry#newCounterMonitor(MonitorName)
*/
@Override
public CounterMonitor newCounterMonitor(MonitorName monitorName) {
final Counter counter = delegate.newCounter(Utils.toMetricName(monitorName));
return new YammerCounterMonitor(counter);
}
代码示例来源:origin: com.arpnetworking.metrics.extras/yammer-extra
final Counter counter = _metricsRegistry.newCounter(YammerMetricsSink.class, entry.getKey());
for (final Quantity sample : entry.getValue()) {
counter.inc(sample.getValue().longValue());
代码示例来源:origin: wavefrontHQ/java
public static void main(String[] args) throws IOException, InterruptedException {
// Parse inputs.
System.out.println("Args: " + Joiner.on(", ").join(args));
if (args.length != 2) {
System.out.println("Usage: java -jar this.jar <metricsPort> <histogramsPort>");
return;
}
int port = Integer.parseInt(args[0]);
int histoPort = Integer.parseInt(args[1]);
// Set up periodic reporting.
MetricsRegistry metricsRegistry = new MetricsRegistry();
WavefrontYammerMetricsReporter wavefrontYammerMetricsReporter = new WavefrontYammerMetricsReporter(metricsRegistry,
"wavefrontYammerMetrics", "localhost", port, histoPort, System::currentTimeMillis);
wavefrontYammerMetricsReporter.start(5, TimeUnit.SECONDS);
// Populate test metrics.
Counter counter = metricsRegistry.newCounter(new TaggedMetricName("group", "mycounter", "tag1", "value1"));
Histogram histogram = metricsRegistry.newHistogram(new TaggedMetricName("group2", "myhisto"), false);
WavefrontHistogram wavefrontHistogram = WavefrontHistogram.get(metricsRegistry,
new TaggedMetricName("group", "mywavefronthisto", "tag2", "value2"));
while (true) {
counter.inc();
histogram.update(counter.count());
wavefrontHistogram.update(counter.count());
Thread.sleep(1000);
}
}
代码示例来源:origin: harbby/presto-connectors
this.metaCacheHits = registry.newCounter(this.getClass(), "metaCacheHits", scope);
this.metaCacheMisses = registry.newCounter(this.getClass(), "metaCacheMisses", scope);
this.getTracker = new CallTracker(this.registry, "Get", scope);
this.scanTracker = new CallTracker(this.registry, "Scan", scope);
内容来源于网络,如有侵权,请联系作者删除!