本文整理汇总了Java中com.codahale.metrics.graphite.GraphiteUDP类的典型用法代码示例。如果您正苦于以下问题:Java GraphiteUDP类的具体用法?Java GraphiteUDP怎么用?Java GraphiteUDP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphiteUDP类属于com.codahale.metrics.graphite包,在下文中一共展示了GraphiteUDP类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
@Override
public GraphiteSender get() {
switch (configuration.getProtocol()) {
case PICKLE:
return new PickledGraphite(
configuration.getAddress(),
SocketFactory.getDefault(),
configuration.getCharset(),
configuration.getPickleBatchSize());
case TCP:
return new Graphite(configuration.getAddress(), SocketFactory.getDefault(), configuration.getCharset());
case UDP:
return new GraphiteUDP(configuration.getAddress());
default:
throw new IllegalArgumentException("Unknown Graphite protocol \"" + configuration.getProtocol() + "\"");
}
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:18,代码来源:GraphiteSenderProvider.java
示例2: initialiseMetrics
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
private void initialiseMetrics(AdminUsersConfig configuration, Environment environment) {
GraphiteSender graphiteUDP = new GraphiteUDP(configuration.getGraphiteHost(), Integer.valueOf(configuration.getGraphitePort()));
GraphiteReporter.forRegistry(environment.metrics())
.prefixedWith(SERVICE_METRICS_NODE)
.build(graphiteUDP)
.start(GRAPHITE_SENDING_PERIOD_SECONDS, TimeUnit.SECONDS);
}
开发者ID:alphagov,项目名称:pay-adminusers,代码行数:9,代码来源:AdminUsersApp.java
示例3: initialiseMetrics
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
private void initialiseMetrics(CardConfiguration configuration, Environment environment) {
GraphiteSender graphiteUDP = new GraphiteUDP(configuration.getGraphiteHost(), Integer.valueOf(configuration.getGraphitePort()));
GraphiteReporter.forRegistry(environment.metrics())
.prefixedWith(SERVICE_METRICS_NODE)
.build(graphiteUDP)
.start(GRAPHITE_SENDING_PERIOD_SECONDS, TimeUnit.SECONDS);
}
开发者ID:alphagov,项目名称:pay-cardid,代码行数:9,代码来源:CardApi.java
示例4: getReturnsGraphiteUDP
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
@Test
public void getReturnsGraphiteUDP() throws Exception {
final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration() {
@Override
public GraphiteProtocol getProtocol() {
return GraphiteProtocol.UDP;
}
};
final GraphiteSenderProvider provider = new GraphiteSenderProvider(configuration);
final GraphiteSender graphiteSender = provider.get();
assertTrue(graphiteSender instanceof GraphiteUDP);
assertFalse(graphiteSender.isConnected());
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:15,代码来源:GraphiteSenderProviderTest.java
示例5: get
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
@Test
public void get() throws Exception {
final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration();
final GraphiteSender graphiteSender = new GraphiteUDP("127.0.0.1", 12345);
final MetricRegistry metricRegistry = new MetricRegistry();
final GraphiteReporterProvider provider = new GraphiteReporterProvider(configuration, graphiteSender, metricRegistry);
final GraphiteReporter reporter = provider.get();
assertNotNull(reporter);
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:11,代码来源:GraphiteReporterProviderTest.java
示例6: graphiteReporter
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
/**
* Create reporter bean and tell Spring to call stop() when shutting down.
* UPD must be enabled in carbon.conf
*
* @return graphite reporter
*/
@Bean(destroyMethod = "stop")
public GraphiteReporter graphiteReporter() {
final GraphiteSender graphite = new GraphiteUDP(new InetSocketAddress("localhost", 2003));
final GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry).prefixedWith("camel-spring-boot").convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
reporter.start(5, TimeUnit.SECONDS);
return reporter;
}
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:Application.java
示例7: initialiseMetrics
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
private void initialiseMetrics(PublicAuthConfiguration configuration, Environment environment) {
GraphiteSender graphiteUDP = new GraphiteUDP(configuration.getGraphiteHost(), Integer.valueOf(configuration.getGraphitePort()));
GraphiteReporter.forRegistry(environment.metrics())
.prefixedWith(SERVICE_METRICS_NODE)
.build(graphiteUDP)
.start(GRAPHITE_SENDING_PERIOD_SECONDS, TimeUnit.SECONDS);
}
开发者ID:alphagov,项目名称:pay-publicauth,代码行数:9,代码来源:PublicAuthApp.java
示例8: initialiseMetrics
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
private void initialiseMetrics(PublicApiConfig configuration, Environment environment) {
GraphiteSender graphiteUDP = new GraphiteUDP(configuration.getGraphiteHost(), Integer.valueOf(configuration.getGraphitePort()));
GraphiteReporter.forRegistry(environment.metrics())
.prefixedWith(SERVICE_METRICS_NODE)
.build(graphiteUDP)
.start(GRAPHITE_SENDING_PERIOD_SECONDS, TimeUnit.SECONDS);
}
开发者ID:alphagov,项目名称:pay-publicapi,代码行数:8,代码来源:PublicApi.java
示例9: getReporter
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
@Override
public ScheduledReporter getReporter(MetricConfig config) {
String host = config.getString(ARG_HOST, null);
int port = config.getInteger(ARG_PORT, -1);
if (host == null || host.length() == 0 || port < 1) {
throw new IllegalArgumentException("Invalid host/port configuration. Host: " + host + " Port: " + port);
}
String prefix = config.getString(ARG_PREFIX, null);
String conversionRate = config.getString(ARG_CONVERSION_RATE, null);
String conversionDuration = config.getString(ARG_CONVERSION_DURATION, null);
String protocol = config.getString(ARG_PROTOCOL, "TCP");
com.codahale.metrics.graphite.GraphiteReporter.Builder builder =
com.codahale.metrics.graphite.GraphiteReporter.forRegistry(registry);
if (prefix != null) {
builder.prefixedWith(prefix);
}
if (conversionRate != null) {
builder.convertRatesTo(TimeUnit.valueOf(conversionRate));
}
if (conversionDuration != null) {
builder.convertDurationsTo(TimeUnit.valueOf(conversionDuration));
}
Protocol prot;
try {
prot = Protocol.valueOf(protocol);
} catch (IllegalArgumentException iae) {
log.warn("Invalid protocol configuration: " + protocol + " Expected: TCP or UDP, defaulting to TCP.");
prot = Protocol.TCP;
}
log.info("Configured GraphiteReporter with {host:{}, port:{}, protocol:{}}", host, port, prot);
switch(prot) {
case UDP:
return builder.build(new GraphiteUDP(host, port));
case TCP:
default:
return builder.build(new Graphite(host, port));
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:47,代码来源:GraphiteReporter.java
示例10: prepare
import com.codahale.metrics.graphite.GraphiteUDP; //导入依赖的package包/类
@Override public void prepare(Map<String, Object> conf) {
if (conf.containsKey(GRAPHITE_HOST_OPTION)) {
graphiteHost = (String) conf.get(GRAPHITE_HOST_OPTION);
}
else {
throw new IllegalArgumentException("Field " + GRAPHITE_HOST_OPTION + " required.");
}
if (conf.containsKey(GRAPHITE_PORT_OPTION)) {
graphitePort = Integer.parseInt((String) conf.get(GRAPHITE_PORT_OPTION));
}
else {
throw new IllegalArgumentException("Field " + GRAPHITE_PORT_OPTION + " required.");
}
if (conf.containsKey(GRAPHITE_MIN_CONNECT_ATTEMPT_INTERVAL_SECS_OPTION)) {
minConnectAttemptIntervalSecs = Integer
.parseInt((String) conf.get(GRAPHITE_MIN_CONNECT_ATTEMPT_INTERVAL_SECS_OPTION));
}
else {
minConnectAttemptIntervalSecs = DEFAULT_MIN_CONNECT_ATTEMPT_INTERVAL_SECS;
}
graphiteSocketAddr = new InetSocketAddress(graphiteHost, graphitePort);
serverFingerprint = graphiteSocketAddr.getAddress() + ":" + graphiteSocketAddr.getPort();
if (conf.containsKey(GRAPHITE_PROTOCOL_OPTION) && ((String)conf.get(GRAPHITE_PROTOCOL_OPTION)).equalsIgnoreCase("udp")) {
// Use UDP client
this.graphite = new GraphiteUDP(graphiteSocketAddr);
} else {
// Default TCP client
int connectTimeout = DEFAULT_CONNECT_TIMEOUT;
if (conf.containsKey(GRAPHITE_CONNECT_TIMEOUT)) {
connectTimeout = Integer.parseInt(conf.get(GRAPHITE_CONNECT_TIMEOUT).toString());
}
int readTimeout = DEFAULT_READ_TIMEOUT;
if (conf.containsKey(GRAPHITE_READ_TIMEOUT)) {
readTimeout = Integer.parseInt(conf.get(GRAPHITE_READ_TIMEOUT).toString());
}
ConfigurableSocketFactory socketFactory = new ConfigurableSocketFactory();
socketFactory.setConnectTimeout(connectTimeout);
socketFactory.setReadTimeout(readTimeout);
this.graphite = new Graphite(graphiteSocketAddr, socketFactory);
}
lastConnectAttemptTimestampMs = 0;
prefix = TagsHelper.getPrefix(conf);
}
开发者ID:verisign,项目名称:storm-graphite,代码行数:52,代码来源:GraphiteReporter.java
注:本文中的com.codahale.metrics.graphite.GraphiteUDP类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论