本文整理汇总了Java中com.netflix.servo.monitor.BasicCounter类的典型用法代码示例。如果您正苦于以下问题:Java BasicCounter类的具体用法?Java BasicCounter怎么用?Java BasicCounter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicCounter类属于com.netflix.servo.monitor包,在下文中一共展示了BasicCounter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCounter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
private static BasicCounter getCounter(String name, String...additionalTags) {
String key = className + "." + name + "." + Joiner.on(",").join(additionalTags);
return errors.computeIfAbsent(key, k -> {
Builder cb = MonitorConfig.builder(name).withTag("class", className);
for(int j = 0; j < additionalTags.length-1; j++) {
String tk = additionalTags[j];
String tv = additionalTags[j+1];
cb.withTag(tk, tv);
j++;
}
MonitorConfig config = cb.build();
BasicCounter bc = new BasicCounter(config);
registry.register(bc);
return bc;
});
}
示例2: ProducerInvocationMonitor
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public ProducerInvocationMonitor(String operationName) {
super(operationName, String.format(MetricsConst.PRODUCER_PREFIX_TEMPLATE, operationName));
this.waitInQueue = new BasicCounter(MonitorConfig.builder(this.getPrefix() + ".waitInQueue.count").build());
this.lifeTimeInQueue = new TimerMonitor(this.getPrefix() + ".lifeTimeInQueue");
this.executionTime = new TimerMonitor(this.getPrefix() + ".executionTime");
this.producerLatency = new TimerMonitor(this.getPrefix() + ".producerLatency");
this.producerCall = new CallMonitor(this.getPrefix() + ".producerCall");
}
示例3: getCounter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public static Counter getCounter(MonitorConfig config) {
Counter v = COUNTERS.get(config);
if (v != null) {
return v;
} else {
Counter counter = new BasicCounter(config);
Counter prevCounter = COUNTERS.putIfAbsent(config, counter);
if (prevCounter != null) {
return prevCounter;
} else {
DefaultMonitorRegistry.getInstance().register(counter);
return counter;
}
}
}
示例4: getNewCounter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
private BasicCounter getNewCounter(String metricName, String opName, String compressionEnabled) {
MonitorConfig config = MonitorConfig.builder(metricName)
.withTag(new BasicTag("dyno_op", opName))
.withTag(new BasicTag("compression_enabled", compressionEnabled))
.build();
return new BasicCounter(config);
}
示例5: getOrCreateCounter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
private BasicCounter getOrCreateCounter(String opName) {
BasicCounter counter = counterMap.get(opName);
if (counter != null) {
return counter;
}
counter = getNewPipelineCounter(opName);
BasicCounter prevCounter = counterMap.putIfAbsent(opName, counter);
if (prevCounter != null) {
return prevCounter;
}
DefaultMonitorRegistry.getInstance().register(counter);
return counter;
}
示例6: getNewPipelineCounter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
private BasicCounter getNewPipelineCounter(String opName) {
String metricName = "Dyno__" + appName + "__PL__" + opName;
MonitorConfig config = MonitorConfig.builder(metricName)
.withTag(new BasicTag("dyno_pl_op", opName))
.build();
return new BasicCounter(config);
}
示例7: RabbitMqTransportClient
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public RabbitMqTransportClient(final Ref ref, final Connection connection) throws IOException {
this.channel = connection.createChannel();
this.sendCount = new BasicCounter(
MonitorConfig.builder("sendCount").withTag(
"transport",
ref.toString()).build());
this.sendFailureCount = new BasicCounter(
MonitorConfig.builder("sendFailureCount").withTag(
"transport",
ref.toString()).build());
this.transportRef = new RabbitMqTransportRef(ref);
DefaultMonitorRegistry.getInstance().register(this.sendCount);
DefaultMonitorRegistry.getInstance().register(this.sendFailureCount);
}
示例8: getWaitInQueue
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public BasicCounter getWaitInQueue() {
return waitInQueue;
}
示例9: CallMonitor
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public CallMonitor(String prefix) {
this.prefix = prefix;
this.total = new BasicCounter(MonitorConfig.builder(prefix + ".total").build());
this.tps = new StepCounter(MonitorConfig.builder(prefix + ".tps").build());
}
示例10: newCounter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
protected static Counter newCounter(String name, String err) {
return new BasicCounter(MonitorConfig.builder(name).withTag("error", err).build());
}
示例11: Meter
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public Meter(MonitorConfig config) {
counter = new BasicCounter(config);
startTime = System.currentTimeMillis() - 1; // to prevent divided by 0
}
示例12: RabbitMqTransport
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public RabbitMqTransport(
final Connection connection,
final Ref transportRef) throws IOException {
this.transportRef = new RabbitMqTransportRef(transportRef);
this.consumers = Lists.newArrayList();
final Counter deliveryCount = new BasicCounter(
MonitorConfig.builder("deliveryCount").withTag(
"transport",
getRef().toString()).build());
final Counter deliveryFailureCount = new BasicCounter(
MonitorConfig.builder("deliveryFailureCount").withTag(
"transport",
getRef().toString()).build());
DefaultMonitorRegistry.getInstance().register(deliveryCount);
DefaultMonitorRegistry.getInstance().register(deliveryFailureCount);
final MonitorConfig consumersSizeMonitorConfig = MonitorConfig.builder("consumers")
.withTag("transport", getRef().toString())
.build();
DefaultMonitorRegistry.getInstance().register(
new BasicGauge<>(
consumersSizeMonitorConfig,
new CollectionSizeCallable(this.consumers)));
final Channel channel = connection.createChannel();
final AMQP.Queue.DeclareOk queueDecl = channel.queueDeclare();
LOGGER.info("queue declared: {}", queueDecl);
final AMQP.Exchange.DeclareOk exchangeDeclOk = channel.exchangeDeclare(
this.transportRef.getExchange(),
this.transportRef.getType(),
true,
true,
Maps.<String, Object>newHashMap());
LOGGER.info("exchange declared: {}", exchangeDeclOk);
final AMQP.Queue.BindOk queueBindOk = channel.queueBind(
queueDecl.getQueue(),
this.transportRef.getExchange(),
"fanout".equals(this.transportRef.getType()) ? "" : this.transportRef.getRoutingKey());
LOGGER.info("queue binding declared: {}", queueBindOk);
final String consumerTag = channel.basicConsume(
queueDecl.getQueue(),
true,
new RabbitMqMessageConsumer(consumers, deliveryCount, deliveryFailureCount));
LOGGER.info("Received consumer tag {}", consumerTag);
}
示例13: load
import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
@Override
public Counter load(final K key) throws Exception {
final Counter c = new BasicCounter(MonitorConfig.builder(buildId(key)).build());
DefaultMonitorRegistry.getInstance().register(c);
return c;
}