Search in sources :

Example 1 with FastForwardReporter

use of com.spotify.metrics.ffwd.FastForwardReporter in project apollo by spotify.

the class MetricsModule method fastForwardReporter.

@Provides
@Singleton
public FastForwardReporter fastForwardReporter(SemanticMetricRegistry metricRegistry, MetricId metricId, FfwdConfig ffwdConfig) {
    try {
        final FastForwardReporter.Builder builder = FastForwardReporter.forRegistry(metricRegistry).schedule(TimeUnit.SECONDS, ffwdConfig.getInterval()).prefix(metricId);
        ffwdConfig.host().ifPresent(builder::host);
        ffwdConfig.port().ifPresent(builder::port);
        final FastForwardReporter reporter = builder.build();
        reporter.start();
        return reporter;
    } catch (IOException e) {
        throw new IllegalStateException("Failed to start ffwd reporter", e);
    }
}
Also used : FastForwardReporter(com.spotify.metrics.ffwd.FastForwardReporter) IOException(java.io.IOException) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)1 Singleton (com.google.inject.Singleton)1 FastForwardReporter (com.spotify.metrics.ffwd.FastForwardReporter)1 IOException (java.io.IOException)1