本文整理汇总了Java中com.timgroup.statsd.NoOpStatsDClient类的典型用法代码示例。如果您正苦于以下问题:Java NoOpStatsDClient类的具体用法?Java NoOpStatsDClient怎么用?Java NoOpStatsDClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoOpStatsDClient类属于com.timgroup.statsd包,在下文中一共展示了NoOpStatsDClient类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createClient
import com.timgroup.statsd.NoOpStatsDClient; //导入依赖的package包/类
private StatsDClient createClient(String statsdHost, int port) {
StatsDClientErrorHandler errorHandler = new StatsDClientErrorHandler() {
@Override
public void handle(Exception exception) {
log.error("Error sending to statsd: " + ExceptionToString.format(exception));
}
};
if (statsdHost == null) {
log.fatal("Error, statsd host not set. It needs to be set in RaptureMETRICS.cfg");
return new NoOpStatsDClient();
} else {
try {
InetAddress address = InetAddress.getByName(statsdHost);
String ip = address.getHostAddress();
log.info(String.format("statsd host=%s, ip=%s", statsdHost, ip));
return createClient(ip, port, errorHandler);
} catch (UnknownHostException e) {
log.error(String.format("Error resolving statsd host ip. hostname=%s - %s", statsdHost, ExceptionToString.format(e)));
return createClient(statsdHost, port, errorHandler);
}
}
}
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:23,代码来源:StatsdStore.java
示例2: createStatsDClient
import com.timgroup.statsd.NoOpStatsDClient; //导入依赖的package包/类
/**
* Returns an initialized instance of the StatsDClient If StatsD is enabled
* this is a NonBlockingStatsDClient which guarantees not to block the thread or
* throw exceptions. If StatsD is not enabled it creates a NoOpStatsDClient which
* contains all empty methods
*
* @return initialized StatsDClient
*/
protected StatsDClient createStatsDClient() {
if (kafkaProducerConfiguration.getStatsDConfiguration() != null) {
final String prefix = kafkaProducerConfiguration.getStatsDConfiguration().getPrefix();
final String host = kafkaProducerConfiguration.getStatsDConfiguration().getHost();
final int port = kafkaProducerConfiguration.getStatsDConfiguration().getPort();
return new NonBlockingStatsDClient(prefix, host, port);
} else {
return new NoOpStatsDClient();
}
}
开发者ID:hubrick,项目名称:vertx-kafka-service,代码行数:20,代码来源:DefaultKafkaProducerService.java
示例3: createStatsDClient
import com.timgroup.statsd.NoOpStatsDClient; //导入依赖的package包/类
/**
* Returns an initialized instance of the StatsDClient If StatsD is enabled
* this is a NonBlockingStatsDClient which guarantees not to block the thread or
* throw exceptions. If StatsD is not enabled it creates a NoOpStatsDClient which
* contains all empty methods
*
* @return initialized StatsDClient
*/
protected StatsDClient createStatsDClient() {
final boolean enabled = getOptionalBooleanConfig(STATSD_ENABLED, DEFAULT_STATSD_ENABLED);
if (enabled) {
final String prefix = getOptionalStringConfig(STATSD_PREFIX, DEFAULT_STATSD_PREFIX);
final String host = getOptionalStringConfig(STATSD_HOST, DEFAULT_STATSD_HOST);
final int port = getOptionalIntConfig(STATSD_PORT, DEFAULT_STATSD_PORT);
return new NonBlockingStatsDClient(prefix, host, port);
}
else {
return new NoOpStatsDClient();
}
}
开发者ID:awin,项目名称:mod-kafka,代码行数:23,代码来源:KafkaMessageProcessor.java
示例4: statsDClient
import com.timgroup.statsd.NoOpStatsDClient; //导入依赖的package包/类
@Provides
StatsDClient statsDClient(DataDogConfig config) {
return config.enabled()
? new NonBlockingStatsDClient(null, config.host(), config.port())
: new NoOpStatsDClient();
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:DataDogManifest.java
示例5: capabilities
import com.timgroup.statsd.NoOpStatsDClient; //导入依赖的package包/类
@Test
public void capabilities() {
reporter = new StatsdReporter(new NoOpStatsDClient());
assertEquals(CapableOf.REPORTING, reporter.capabilities());
}
开发者ID:uber-java,项目名称:tally,代码行数:7,代码来源:StatsdReporterTest.java
示例6: buildingWithStatsDClientProvidedIsOkay
import com.timgroup.statsd.NoOpStatsDClient; //导入依赖的package包/类
@Test
public void buildingWithStatsDClientProvidedIsOkay() {
config.setLivenessMetric("whatever");
assertNotNull(config.build(new NoOpStatsDClient()));
}
开发者ID:washingtonpost,项目名称:dropwizard-liveness-reporter,代码行数:6,代码来源:TestLivenessConfiguration.java
注:本文中的com.timgroup.statsd.NoOpStatsDClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论