use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class MicrometerTest method testExposedMetrics.
@Test
public void testExposedMetrics() {
Configuration configuration = new Configuration("exposedmetrics");
final JaegerTracer tracer = configuration.getTracerBuilder().withMetrics(metrics).build();
// This is a gauge, so it needs to be non-zero to come back from prometheus
metrics.reporterQueueLength.update(1);
List<Meter> meters = new ArrayList<>(prometheusRegistry.getMeters());
Map<String, Long> metricCounts = meters.stream().collect(groupingBy(m -> m.getId().getName(), counting()));
assertEquals("Wrong number of metrics collected", expectedMetricCounts.size(), metricCounts.keySet().size());
for (String name : metricCounts.keySet()) {
assertTrue("Unexpected metric " + name, expectedMetricCounts.containsKey(name));
}
for (String metricName : expectedMetricCounts.keySet()) {
assertTrue("Did not find metric " + metricName, metricCounts.containsKey(metricName));
assertEquals("Wrong count for " + metricName, expectedMetricCounts.get(metricName), metricCounts.get(metricName));
}
tracer.close();
}
use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class MicrometerTest method setUp.
@Before
public void setUp() {
registry = io.micrometer.core.instrument.Metrics.globalRegistry;
prometheusRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
io.micrometer.core.instrument.Metrics.addRegistry(prometheusRegistry);
metrics = new Metrics(new MicrometerMetricsFactory());
}
use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class ConfigurationTest method testProbabilisticSampler.
@Test
public void testProbabilisticSampler() {
SamplerConfiguration samplerConfiguration = new SamplerConfiguration().withType(ProbabilisticSampler.TYPE);
Sampler sampler = samplerConfiguration.createSampler("name", new Metrics(new InMemoryMetricsFactory()));
assertTrue(sampler instanceof ProbabilisticSampler);
}
use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class ConfigurationTest method testRateLimitingSampler.
@Test
public void testRateLimitingSampler() {
SamplerConfiguration samplerConfiguration = new SamplerConfiguration().withType(RateLimitingSampler.TYPE);
Sampler sampler = samplerConfiguration.createSampler("name", new Metrics(new InMemoryMetricsFactory()));
assertTrue(sampler instanceof RateLimitingSampler);
}
use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class JaegerTracerTest method setUp.
@Before
public void setUp() {
metricsFactory = new InMemoryMetricsFactory();
tracer = new JaegerTracer.Builder("TracerTestService").withReporter(new InMemoryReporter()).withSampler(new ConstSampler(true)).withMetrics(new Metrics(metricsFactory)).build();
}
Aggregations