类com.codahale.metrics.Reporter源码实例Demo

下面列出了怎么用com.codahale.metrics.Reporter的API类实例代码及写法,或者点击链接到github查看源代码。

@Override
public void activateService() {
    metricRegistry = new MetricRegistry();
    healthCheckRegistry = new HealthCheckRegistry();
    CodahaleMetricsDeclaration declaration = descriptor.metaInfo( CodahaleMetricsDeclaration.class );
    prefix = declaration.prefix() != null ? declaration.prefix() : app.name();
    fqcn = declaration.fqcn();
    if( declaration.jmx() )
    {
        JmxReporter jmxReporter = JmxReporter.forRegistry( metricRegistry ).build();
        jmxReporter.start();
        reporters.add( jmxReporter );
    }
    for( Function<MetricRegistry, Reporter> reporterFactory : declaration.reportersFactories())
    {
        reporters.add( reporterFactory.apply( metricRegistry ) );
    }
}
 
源代码2 项目: riposte   文件: DefaultGraphiteReporterFactory.java
@Override
public synchronized Reporter getReporter(MetricRegistry registry) {
    if (null == reporter) {
        Graphite graphite = new Graphite(new InetSocketAddress(graphiteURL, graphitePort));
        reporter = GraphiteReporter.forRegistry(registry)
                                   .prefixedWith(prefix)
                                   .convertRatesTo(TimeUnit.SECONDS)
                                   .convertDurationsTo(TimeUnit.MILLISECONDS)
                                   .filter(MetricFilter.ALL)
                                   .build(graphite);
    }
    return reporter;
}
 
源代码3 项目: riposte   文件: DefaultSLF4jReporterFactory.java
@Override
public synchronized Reporter getReporter(MetricRegistry registry) {
    if (null == reporter) {
        reporter = Slf4jReporter.forRegistry(registry)
                                .outputTo(LoggerFactory.getLogger(prefix))
                                .convertRatesTo(TimeUnit.SECONDS)
                                .convertDurationsTo(TimeUnit.MILLISECONDS)
                                .build();
    }
    return reporter;
}
 
源代码4 项目: riposte   文件: DefaultJMXReporterFactory.java
@Override
public synchronized Reporter getReporter(MetricRegistry registry) {
    if (null == reporter) {
        reporter = JmxReporter.forRegistry(registry).build();
    }
    return reporter;
}
 
源代码5 项目: riposte   文件: DefaultConsoleReporterFactory.java
@Override
public synchronized Reporter getReporter(MetricRegistry registry) {
    if (null == reporter) {
        reporter = ConsoleReporter.forRegistry(registry)
                                  .convertRatesTo(TimeUnit.SECONDS)
                                  .convertDurationsTo(TimeUnit.MILLISECONDS)
                                  .build();
    }
    return reporter;
}
 
源代码6 项目: riposte   文件: ReporterFactoryInstanceTest.java
@Test
public void test() {
    MetricRegistry registry = new MetricRegistry();
    Reporter r = new DefaultConsoleReporterFactory().getReporter(registry);
    assertNotNull(r);
    r = new DefaultJMXReporterFactory().getReporter(registry);
    assertNotNull(r);
    r = new DefaultSLF4jReporterFactory().getReporter(registry);
    assertNotNull(r);
    r = new DefaultGraphiteReporterFactory("test", "fakeurl.com", 4242).getReporter(registry);
    assertNotNull(r);
    r = new RiposteGraphiteReporterFactory("test", "fakeurl.com", 4242).getReporter(registry);
}
 
源代码7 项目: riposte   文件: CodahaleMetricsEngineTest.java
@Override
public Reporter getReporter(MetricRegistry registry) {
    return this;
}
 
源代码8 项目: riposte   文件: CodahaleMetricsEngineTest.java
@Override
public Reporter getReporter(MetricRegistry registry) {
    return this;
}
 
源代码9 项目: riposte   文件: CodahaleMetricsEngineTest.java
@Override
public Reporter getReporter(MetricRegistry registry) {
    return this;
}
 
源代码10 项目: riposte   文件: CodahaleMetricsEngineTest.java
@Override
public Reporter getReporter(MetricRegistry registry) {
    return this;
}
 
public List<Function<MetricRegistry, Reporter>> reportersFactories()
{
    return reportersFactories;
}
 
public CodahaleMetricsAssembler withReporter( Function<MetricRegistry, Reporter> factory )
{
    declaration.reportersFactories.add( factory );
    return this;
}
 
源代码13 项目: riposte   文件: ReporterFactory.java
/**
 * Get the singleton instance of the Reporter wrapped by this ReporterFactory
 *
 * @param registry
 *     The MetricRegistry that the Reporter will be reporting on
 */
Reporter getReporter(MetricRegistry registry);
 
 类所在包
 类方法
 同包方法