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


Java StatsDReporter类代码示例

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


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

示例1: build

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
/**
 * Configures and builds a {@link ScheduledReporter} instance for the given registry.
 *
 * @param registry the metrics registry to report metrics from.
 * @return a reporter configured for the given metrics registry.
 */
@Override
public ScheduledReporter build(MetricRegistry registry) {

    StatsDReporter.Builder builder
            = StatsDReporter.forRegistry(registry)
                            .convertDurationsTo(getDurationUnit())
                            .convertRatesTo(getRateUnit())
                            .filter(getFilter());

    LOG.info("StatsDReporterFactory built with host: {}, port: {}", getHost(), getPort());

    return builder.build(getHost(), getPort());
}
 
开发者ID:bspindler,项目名称:statsd-reporter-example,代码行数:20,代码来源:StatsDReporterFactory.java

示例2: apply

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
/**
 * Starts logging the metrics for cassandra into statsd. 
 */
public static void apply(ActorSystem system) {
    MetricRegistry registry = CassandraMetricsRegistry.get(system).getRegistry();
    
    String statsdhost = system.settings().config().getString("codahale.statsd.hostname");
    int statsdport = system.settings().config().getInt("codahale.statsd.port");
    long interval = system.settings().config().getDuration("codahale.statsd.tick-interval", TimeUnit.MILLISECONDS);
    String prefix = system.settings().config().getString("codahale.statsd.prefix");
    StatsDReporter.forRegistry(registry)
        .prefixedWith(prefix)
        .build(statsdhost, statsdport)           
        .start(interval, TimeUnit.MILLISECONDS);
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:16,代码来源:CassandraLogger.java

示例3: statsDReporter

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
@Bean
public StatsDReporter statsDReporter() {
    // @formatter:off
    return StatsDReporter
            .forRegistry(metricRegistry)
            .prefixedWith(String.format("%s.%s", statsdSettings.getApplicationName(), statsdSettings.getApplicationHostname()))
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .convertRatesTo(TimeUnit.SECONDS)
            .filter(MetricFilter.ALL)
            .build(statsdSettings.getHostname(), statsdSettings.getPort());
    // @formatter:on
}
 
开发者ID:fastnsilver,项目名称:xlator,代码行数:13,代码来源:MonitoringSupport.java

示例4: createAndStartStatsDReporter

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
/**
 * Create a reporter to send metrics to Graphite.
 * @param registry the metric registry
 * @param host the host of the metrics server
 * @param port the port of the metrics server
 * @param prefix the prefix for the metrics
 * @param reportingTime the amount of time between polls
 */
@SuppressWarnings("checkstyle:designforextension")
public void createAndStartStatsDReporter(
        final MetricRegistry registry,
        final String host,
        final int port,
        final String prefix,
        final int reportingTime) {
    StatsDReporter.forRegistry(registry)
            .prefixedWith(prefix)
            .build(host, port)
            .start(reportingTime, TimeUnit.SECONDS);
}
 
开发者ID:datasift,项目名称:datasift-connector,代码行数:21,代码来源:Metrics.java

示例5: createStatsDReporter

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
private StatsDReporter createStatsDReporter(URI uri) {
    StatsDReporter statsDReporter = StatsDReporter.forRegistry(registry)
            .prefixedWith(configuration.getString(CK_PREFIX))
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .filter(MetricFilter.ALL)
            .build(uri.getHost(), uri.getPort());
    statsDReporter.start(configuration.getInt(CK_RUN_RATE), TimeUnit.SECONDS);
    return statsDReporter;
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics,代码行数:11,代码来源:MetricsOutput.java

示例6: configureStatsd

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
/**
 * Configures the metrics service to emit StatsD-formatted metrics to the configured UDP host/port with the
 * specified interval.
 */
public static void configureStatsd(SchedulerConfig schedulerConfig) {
    StatsDReporter.forRegistry(metrics)
            .build(schedulerConfig.getStatsdHost(), schedulerConfig.getStatsdPort())
            .start(schedulerConfig.getStatsDPollIntervalS(), TimeUnit.SECONDS);
}
 
开发者ID:mesosphere,项目名称:dcos-commons,代码行数:10,代码来源:Metrics.java

示例7: start

import com.readytalk.metrics.StatsDReporter; //导入依赖的package包/类
@Synchronized
@Override
public void start() {
    init();

    if (conf.isEnableCSVReporter()) {
        // NOTE:  metrics output files are exclusive to a given process
        File outdir;
        if (!Strings.isNullOrEmpty(conf.getMetricsPrefix())) {
            outdir = new File(conf.getCsvEndpoint(), conf.getMetricsPrefix());
        } else {
            outdir = new File(conf.getCsvEndpoint());
        }
        outdir.mkdirs();
        log.info("Configuring stats with csv output to directory [{}]", outdir.getAbsolutePath());
        reporters.add(CsvReporter.forRegistry(getMetrics())
                      .convertRatesTo(TimeUnit.SECONDS)
                      .convertDurationsTo(TimeUnit.MILLISECONDS)
                      .build(outdir));
    }
    if (conf.isEnableStatsdReporter()) {
        log.info("Configuring stats with statsD at {}:{}", conf.getStatsDHost(), conf.getStatsDPort());
        reporters.add(StatsDReporter.forRegistry(getMetrics())
                      .build(conf.getStatsDHost(), conf.getStatsDPort()));
    }
    if (conf.isEnableGraphiteReporter()) {
        log.info("Configuring stats with graphite at {}:{}", conf.getGraphiteHost(), conf.getGraphitePort());
        final Graphite graphite = new Graphite(new InetSocketAddress(conf.getGraphiteHost(), conf.getGraphitePort()));
        reporters.add(GraphiteReporter.forRegistry(getMetrics())
            .prefixedWith(conf.getMetricsPrefix())
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .filter(MetricFilter.ALL)
            .build(graphite));
    }
    if (conf.isEnableJMXReporter()) {
        log.info("Configuring stats with jmx {}", conf.getJmxDomain());
        final JmxReporter jmx = JmxReporter.forRegistry(getMetrics())
            .inDomain(conf.getJmxDomain())
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        jmx.start();
    }
    if (conf.isEnableGangliaReporter()) {
        try {
            log.info("Configuring stats with ganglia at {}:{}", conf.getGangliaHost(), conf.getGangliaPort());
            final GMetric ganglia = new GMetric(conf.getGangliaHost(), conf.getGangliaPort(), GMetric.UDPAddressingMode.MULTICAST, 1);
            reporters.add(GangliaReporter.forRegistry(getMetrics())
                .prefixedWith(conf.getMetricsPrefix())
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS)
                .build(ganglia));
        } catch (IOException e) {
            log.warn("ganglia create failure: {}", e);
        }
    }
    if (conf.isEnableConsoleReporter()) {
        log.info("Configuring console reporter");
        reporters.add(ConsoleReporter.forRegistry(getMetrics())
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build());
    }
    for (ScheduledReporter r : reporters) {
        r.start(conf.getStatsOutputFrequencySeconds(), TimeUnit.SECONDS);
    }
}
 
开发者ID:pravega,项目名称:pravega,代码行数:69,代码来源:StatsProviderImpl.java


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