Search in sources :

Example 1 with GraphiteReporter

use of com.codahale.metrics.graphite.GraphiteReporter in project indy by Commonjava.

the class ReporterIntializer method initGraphiteReporterForHealthCheckMetric.

private void initGraphiteReporterForHealthCheckMetric(MetricRegistry metrics, IndyMetricsConfig config) {
    final Graphite graphite = new Graphite(new InetSocketAddress(config.getGrphiterHostName(), config.getGrphiterPort()));
    final GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics).prefixedWith(config.getGrphiterPrefix()).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter((name, metric) -> {
        if (!name.contains(FILTER_SIMPLE) && name.contains(FILTER_HEALTHCHECK)) {
            return true;
        }
        return false;
    }).build(graphite);
    reporter.start(config.getGrphiterHealthcheckPeriod(), TimeUnit.SECONDS);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ZabbixCacheStorage(org.commonjava.indy.metrics.zabbix.cache.ZabbixCacheStorage) IndyMetricsConfig(org.commonjava.indy.metrics.conf.IndyMetricsConfig) IndyZabbixSender(org.commonjava.indy.metrics.zabbix.sender.IndyZabbixSender) Graphite(com.codahale.metrics.graphite.Graphite) InetSocketAddress(java.net.InetSocketAddress) IndyHttpProvider(org.commonjava.indy.subsys.http.IndyHttpProvider) Inject(javax.inject.Inject) TimeUnit(java.util.concurrent.TimeUnit) IndyZabbixReporter(org.commonjava.indy.metrics.zabbix.reporter.IndyZabbixReporter) IndyMetricsNamed(org.commonjava.indy.metrics.conf.annotation.IndyMetricsNamed) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) ConsoleReporter(com.codahale.metrics.ConsoleReporter) ApplicationScoped(javax.enterprise.context.ApplicationScoped) InetSocketAddress(java.net.InetSocketAddress) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) Graphite(com.codahale.metrics.graphite.Graphite)

Example 2 with GraphiteReporter

use of com.codahale.metrics.graphite.GraphiteReporter in project indy by Commonjava.

the class ReporterIntializer method initGraphiteReporterForSimpleMetric.

private void initGraphiteReporterForSimpleMetric(MetricRegistry metrics, IndyMetricsConfig config) {
    final Graphite graphite = new Graphite(new InetSocketAddress(config.getGrphiterHostName(), config.getGrphiterPort()));
    final GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics).prefixedWith(config.getGrphiterPrefix()).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter((name, metric) -> {
        if (name.contains(FILTER_SIMPLE)) {
            return true;
        }
        return false;
    }).build(graphite);
    reporter.start(config.getGrphiterSimplePriod(), TimeUnit.SECONDS);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ZabbixCacheStorage(org.commonjava.indy.metrics.zabbix.cache.ZabbixCacheStorage) IndyMetricsConfig(org.commonjava.indy.metrics.conf.IndyMetricsConfig) IndyZabbixSender(org.commonjava.indy.metrics.zabbix.sender.IndyZabbixSender) Graphite(com.codahale.metrics.graphite.Graphite) InetSocketAddress(java.net.InetSocketAddress) IndyHttpProvider(org.commonjava.indy.subsys.http.IndyHttpProvider) Inject(javax.inject.Inject) TimeUnit(java.util.concurrent.TimeUnit) IndyZabbixReporter(org.commonjava.indy.metrics.zabbix.reporter.IndyZabbixReporter) IndyMetricsNamed(org.commonjava.indy.metrics.conf.annotation.IndyMetricsNamed) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) ConsoleReporter(com.codahale.metrics.ConsoleReporter) ApplicationScoped(javax.enterprise.context.ApplicationScoped) InetSocketAddress(java.net.InetSocketAddress) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) Graphite(com.codahale.metrics.graphite.Graphite)

Example 3 with GraphiteReporter

use of com.codahale.metrics.graphite.GraphiteReporter in project camel by apache.

the class Application method graphiteReporter.

/**
     * 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;
}
Also used : GraphiteSender(com.codahale.metrics.graphite.GraphiteSender) InetSocketAddress(java.net.InetSocketAddress) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) GraphiteUDP(com.codahale.metrics.graphite.GraphiteUDP) Bean(org.springframework.context.annotation.Bean)

Example 4 with GraphiteReporter

use of com.codahale.metrics.graphite.GraphiteReporter in project indy by Commonjava.

the class ReporterIntializer method initGraphiteReporterForJVMMetric.

private void initGraphiteReporterForJVMMetric(MetricRegistry metrics, IndyMetricsConfig config) {
    final Graphite graphite = new Graphite(new InetSocketAddress(config.getGrphiterHostName(), config.getGrphiterPort()));
    final GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics).prefixedWith(config.getGrphiterPrefix()).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter((name, metric) -> {
        if (!name.contains(FILTER_SIMPLE) && name.contains(FILTER_JVM)) {
            return true;
        }
        return false;
    }).build(graphite);
    reporter.start(config.getGrphiterJVMPriod(), TimeUnit.SECONDS);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ZabbixCacheStorage(org.commonjava.indy.metrics.zabbix.cache.ZabbixCacheStorage) IndyMetricsConfig(org.commonjava.indy.metrics.conf.IndyMetricsConfig) IndyZabbixSender(org.commonjava.indy.metrics.zabbix.sender.IndyZabbixSender) Graphite(com.codahale.metrics.graphite.Graphite) InetSocketAddress(java.net.InetSocketAddress) IndyHttpProvider(org.commonjava.indy.subsys.http.IndyHttpProvider) Inject(javax.inject.Inject) TimeUnit(java.util.concurrent.TimeUnit) IndyZabbixReporter(org.commonjava.indy.metrics.zabbix.reporter.IndyZabbixReporter) IndyMetricsNamed(org.commonjava.indy.metrics.conf.annotation.IndyMetricsNamed) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) ConsoleReporter(com.codahale.metrics.ConsoleReporter) ApplicationScoped(javax.enterprise.context.ApplicationScoped) InetSocketAddress(java.net.InetSocketAddress) GraphiteReporter(com.codahale.metrics.graphite.GraphiteReporter) Graphite(com.codahale.metrics.graphite.Graphite)

Aggregations

GraphiteReporter (com.codahale.metrics.graphite.GraphiteReporter)4 InetSocketAddress (java.net.InetSocketAddress)4 ConsoleReporter (com.codahale.metrics.ConsoleReporter)3 MetricRegistry (com.codahale.metrics.MetricRegistry)3 Graphite (com.codahale.metrics.graphite.Graphite)3 TimeUnit (java.util.concurrent.TimeUnit)3 ApplicationScoped (javax.enterprise.context.ApplicationScoped)3 Inject (javax.inject.Inject)3 IndyMetricsConfig (org.commonjava.indy.metrics.conf.IndyMetricsConfig)3 IndyMetricsNamed (org.commonjava.indy.metrics.conf.annotation.IndyMetricsNamed)3 ZabbixCacheStorage (org.commonjava.indy.metrics.zabbix.cache.ZabbixCacheStorage)3 IndyZabbixReporter (org.commonjava.indy.metrics.zabbix.reporter.IndyZabbixReporter)3 IndyZabbixSender (org.commonjava.indy.metrics.zabbix.sender.IndyZabbixSender)3 IndyHttpProvider (org.commonjava.indy.subsys.http.IndyHttpProvider)3 GraphiteSender (com.codahale.metrics.graphite.GraphiteSender)1 GraphiteUDP (com.codahale.metrics.graphite.GraphiteUDP)1 Bean (org.springframework.context.annotation.Bean)1