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


Java BasicCounter类代码示例

本文整理汇总了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;
	});
}
 
开发者ID:Netflix,项目名称:conductor,代码行数:17,代码来源:WorkflowTaskMetrics.java

示例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");
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:ProducerInvocationMonitor.java

示例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;
        }
    }
}
 
开发者ID:dmuino,项目名称:atlas-oss-plugin,代码行数:16,代码来源:Servo.java

示例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);
}
 
开发者ID:Netflix,项目名称:dyno,代码行数:8,代码来源:DynoOPMonitor.java

示例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; 
}
 
开发者ID:Netflix,项目名称:dyno,代码行数:15,代码来源:DynoJedisPipelineMonitor.java

示例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);
}
 
开发者ID:Netflix,项目名称:dyno,代码行数:9,代码来源:DynoJedisPipelineMonitor.java

示例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);
}
 
开发者ID:ngerakines,项目名称:elasticservices,代码行数:16,代码来源:RabbitMqTransportClient.java

示例8: getWaitInQueue

import com.netflix.servo.monitor.BasicCounter; //导入依赖的package包/类
public BasicCounter getWaitInQueue() {
  return waitInQueue;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:4,代码来源:ProducerInvocationMonitor.java

示例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());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:6,代码来源:CallMonitor.java

示例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());
}
 
开发者ID:dmuino,项目名称:atlas-oss-plugin,代码行数:4,代码来源:BaseAtlasMetricObserver.java

示例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
}
 
开发者ID:Netflix,项目名称:suro,代码行数:5,代码来源:Meter.java

示例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);
}
 
开发者ID:ngerakines,项目名称:elasticservices,代码行数:51,代码来源:RabbitMqTransport.java

示例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;
}
 
开发者ID:ngerakines,项目名称:elasticservices,代码行数:7,代码来源:CounterCacheLoader.java


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