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


Java BasicGauge类代码示例

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


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

示例1: RabbitMqTransport

import com.netflix.servo.monitor.BasicGauge; //导入依赖的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

示例2: gauge

import com.netflix.servo.monitor.BasicGauge; //导入依赖的package包/类
public static <T extends Number> Gauge<T> gauge(final String id, final Callable<T> callable) {
	return new BasicGauge<>(MonitorConfig.builder(id).build(), callable);
}
 
开发者ID:ngerakines,项目名称:elasticservices,代码行数:4,代码来源:Gauges.java


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