use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class Configuration method getTracerBuilder.
public JaegerTracer.Builder getTracerBuilder() {
if (reporterConfig == null) {
reporterConfig = new ReporterConfiguration();
}
if (samplerConfig == null) {
samplerConfig = new SamplerConfiguration();
}
if (codecConfig == null) {
codecConfig = new CodecConfiguration();
}
if (metricsFactory == null) {
metricsFactory = loadMetricsFactory();
}
Metrics metrics = new Metrics(metricsFactory);
Reporter reporter = reporterConfig.getReporter(metrics);
Sampler sampler = samplerConfig.createSampler(serviceName, metrics);
JaegerTracer.Builder builder = createTracerBuilder(serviceName).withSampler(sampler).withReporter(reporter).withMetrics(metrics).withTags(tracerTags);
if (useTraceId128Bit) {
builder = builder.withTraceId128Bit();
}
codecConfig.apply(builder);
return builder;
}
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 JaegerSpanTest method setUp.
@Before
public void setUp() {
metricsFactory = new InMemoryMetricsFactory();
reporter = new InMemoryReporter();
clock = mock(Clock.class);
metrics = new Metrics(metricsFactory);
final JaegerTracer.Builder tracerBuilder = new JaegerTracer.Builder("SamplerTest").withReporter(reporter).withSampler(new ConstSampler(true)).withMetrics(metrics).withClock(clock).withBaggageRestrictionManager(new DefaultBaggageRestrictionManager()).withExpandExceptionLogs();
tracer = tracerBuilder.build();
tracer128 = tracerBuilder.withTraceId128Bit().build();
jaegerSpan = tracer.buildSpan("some-operation").start();
}
use of io.jaegertracing.internal.metrics.Metrics in project jaeger-client-java by jaegertracing.
the class RemoteBaggageRestrictionManagerTest method setUp.
@Before
public void setUp() throws Exception {
metricsFactory = new InMemoryMetricsFactory();
metrics = new Metrics(metricsFactory);
}
Aggregations