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


Java GraphiteSender类代码示例

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


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

示例1: get

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的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.GraphiteSender; //导入依赖的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.GraphiteSender; //导入依赖的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: initGraphiteReporter

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
private static void initGraphiteReporter(final GraphiteReporterConfig graphiteReporterConfig) {
    HostAndPort hostAndPort = graphiteReporterConfig.getAddress();
    InetSocketAddress inetSocketAddress = new InetSocketAddress(hostAndPort.getHost(), hostAndPort.getPort());

    GraphiteSender graphiteSender = graphiteReporterConfig.isEnableBatching()
            ? new PickledGraphite(inetSocketAddress)
            : new Graphite(inetSocketAddress);

    graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
            .prefixedWith(prefix)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MICROSECONDS)
            .withClock(new Clock() {
                private long lastReportingTime = 0;

                @Override
                public long getTick() {
                    return System.nanoTime();
                }

                @Override
                public synchronized long getTime() {
                    if (lastReportingTime == 0) {
                        lastReportingTime = System.currentTimeMillis();
                        return lastReportingTime;
                    }
                    lastReportingTime += graphiteReporterConfig.getReportingIntervalInSeconds() * 1000;
                    return lastReportingTime;
                }
            })
            .filter(buildMetricFilter(graphiteReporterConfig.getStartsWithFilters(), graphiteReporterConfig.getBlockedStartsWithFilters()))
            .build(graphiteSender);

    graphiteReporter.start(graphiteReporterConfig.getReportingIntervalInSeconds(), TimeUnit.SECONDS);
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:36,代码来源:MonitoringCenter.java

示例5: configure

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
@Override
protected void configure() {
    bind(GraphiteSender.class).toProvider(GraphiteSenderProvider.class);
    bind(GraphiteReporter.class).toProvider(GraphiteReporterProvider.class);

    addConfigBeans();
    addInitializer(MetricsGraphiteReporterService.class);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:9,代码来源:MetricsGraphiteReporterModule.java

示例6: GraphiteReporterProvider

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
@Inject
public GraphiteReporterProvider(MetricsGraphiteReporterConfiguration configuration,
                                GraphiteSender graphiteSender,
                                MetricRegistry metricRegistry) {
    this.configuration = requireNonNull(configuration);
    this.graphiteSender = requireNonNull(graphiteSender);
    this.metricRegistry = requireNonNull(metricRegistry);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:9,代码来源:GraphiteReporterProvider.java

示例7: getReturnsGraphite

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
@Test
public void getReturnsGraphite() throws Exception {
    final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration() {
        @Override
        public GraphiteProtocol getProtocol() {
            return GraphiteProtocol.TCP;
        }
    };
    final GraphiteSenderProvider provider = new GraphiteSenderProvider(configuration);

    final GraphiteSender graphiteSender = provider.get();
    assertTrue(graphiteSender instanceof Graphite);
    assertFalse(graphiteSender.isConnected());
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:15,代码来源:GraphiteSenderProviderTest.java

示例8: getReturnsGraphiteUDP

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的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

示例9: getReturnsGraphitePickledGraphite

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
@Test
public void getReturnsGraphitePickledGraphite() throws Exception {
    final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration() {
        @Override
        public GraphiteProtocol getProtocol() {
            return GraphiteProtocol.PICKLE;
        }
    };
    final GraphiteSenderProvider provider = new GraphiteSenderProvider(configuration);

    final GraphiteSender graphiteSender = provider.get();
    assertTrue(graphiteSender instanceof PickledGraphite);
    assertFalse(graphiteSender.isConnected());
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:15,代码来源:GraphiteSenderProviderTest.java

示例10: get

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的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

示例11: graphiteReporter

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
@Bean(destroyMethod = "stop")
public GraphiteReporter graphiteReporter() {
    GraphiteSender sender = new Graphite("localhost", 2003);
    GraphiteReporter reporter = GraphiteReporter.forRegistry(registry).prefixedWith("user-service").convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build(sender);
    reporter.start(10, TimeUnit.SECONDS);
    return reporter;
}
 
开发者ID:vdjurovic,项目名称:devramble,代码行数:8,代码来源:DropwizardMetricsConfig.java

示例12: graphiteReporter

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的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

示例13: initialiseMetrics

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的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

示例14: initialiseMetrics

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的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

示例15: GraphiteMetricSender

import com.codahale.metrics.graphite.GraphiteSender; //导入依赖的package包/类
GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix) {
  this.graphite = graphite;
  this.clock = clock;
  this.prefix = prefix;
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:6,代码来源:GraphiteMetricSender.java


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