use of com.spotify.metrics.core.SemanticMetricRegistry in project apollo by spotify.
the class MetricsTest method testJvmMetricSets.
@Test
public void testJvmMetricSets() throws Exception {
final Injector injector = Guice.createInjector(this, MetricsModule.create());
final SemanticMetricRegistry metricRegistry = injector.getInstance(SemanticMetricRegistry.class);
// a little dicey to have to know what tags the MetricSets created metrics with to assert that
// the Set itself was registered but there is no other obvious way to test these
assertFalse("Expected MemoryUsageGaugeSet metrics to be registered with registry", metricRegistry.getGauges(filterByTag("what", "jvm-memory-usage")).isEmpty());
assertFalse("Expected GarbageCollectorMetricSet metrics to be registered with registry", metricRegistry.getGauges(filterByTag("what", "jvm-gc-collections")).isEmpty());
assertFalse("Expected ThreadStatesMetricSet metrics to be registered with registry", metricRegistry.getGauges(filterByTag("what", "jvm-thread-state")).isEmpty());
assertFalse("Expected CpuGaugeSet metrics to be registered with registry", metricRegistry.getGauges(filterByTag("what", "process-cpu-load-percentage")).isEmpty());
assertFalse("Expected FileDescriptorRatioGaugeSet metrics to be registered with registry", metricRegistry.getGauges(filterByTag("what", "file-descriptor-ratio")).isEmpty());
}
use of com.spotify.metrics.core.SemanticMetricRegistry in project apollo by spotify.
the class SemanticServiceMetricsTest method setupWith.
private void setupWith(Predicate<What> predicate, Set<Integer> precreateCodes) {
metricRegistry = new SemanticMetricRegistry();
SemanticServiceMetrics serviceMetrics = new SemanticServiceMetrics(metricRegistry, MetricId.EMPTY.tagged("service", "test-service"), precreateCodes, predicate);
requestMetrics = serviceMetrics.metricsForEndpointCall("hm://foo/<bar>");
}
use of com.spotify.metrics.core.SemanticMetricRegistry in project apollo by spotify.
the class MetricsModule method semanticMetricRegistry.
@Provides
@Singleton
public SemanticMetricRegistry semanticMetricRegistry() {
final SemanticMetricRegistry metricRegistry = new SemanticMetricRegistry();
LOG.info("Creating SemanticMetricRegistry");
// register JVM metricSets, using an empty MetricId as the FastForwardReporter will prepend
// the injected MetricId.
metricRegistry.register(MetricId.EMPTY, new MemoryUsageGaugeSet());
metricRegistry.register(MetricId.EMPTY, new GarbageCollectorMetricSet());
metricRegistry.register(MetricId.EMPTY, new ThreadStatesMetricSet());
metricRegistry.register(MetricId.EMPTY, CpuGaugeSet.create());
metricRegistry.register(MetricId.EMPTY, new FileDescriptorGaugeSet());
return metricRegistry;
}
Aggregations