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);
}
}
Aggregations