use of io.jaegertracing.Configuration in project hono by eclipse.
the class MessageAnnotationsInjectExtractAdapterTest method testJaegerTracerCanUseAdapter.
/**
* Verifies that the Jaeger tracer implementation can successfully use the adapter to inject and extract
* a SpanContext.
*/
@Test
public void testJaegerTracerCanUseAdapter() {
final Configuration config = new Configuration("test");
final Tracer tracer = config.getTracer();
final Span span = tracer.buildSpan("do").start();
final Message message = ProtonHelper.message();
final MessageAnnotationsInjectAdapter injectAdapter = new MessageAnnotationsInjectAdapter(message, propertiesMapName);
tracer.inject(span.context(), Format.Builtin.TEXT_MAP, injectAdapter);
final SpanContext context = tracer.extract(Format.Builtin.TEXT_MAP, new MessageAnnotationsExtractAdapter(message, propertiesMapName));
assertThat(context.toSpanId()).isEqualTo(span.context().toSpanId());
}
use of io.jaegertracing.Configuration in project hono by eclipse.
the class MultiMapInjectExtractAdapterTest method testJaegerTracerCanUseAdapter.
/**
* Verifies that the Jaeger tracer implementation can successfully use the adapter to inject and extract
* a SpanContext.
*/
@Test
public void testJaegerTracerCanUseAdapter() {
final Configuration config = new Configuration("test");
final Tracer tracer = config.getTracer();
final Span span = tracer.buildSpan("do").start();
final MultiMap multiMap = MultiMap.caseInsensitiveMultiMap();
final MultiMapInjectAdapter injectAdapter = new MultiMapInjectAdapter(multiMap);
tracer.inject(span.context(), Format.Builtin.TEXT_MAP, injectAdapter);
final SpanContext context = tracer.extract(Format.Builtin.TEXT_MAP, new MultiMapExtractAdapter(multiMap));
assertThat(context.toSpanId()).isEqualTo(span.context().toSpanId());
}
use of io.jaegertracing.Configuration in project hono by eclipse.
the class JsonObjectInjectExtractAdapterTest method testJaegerTracerCanUseAdapter.
/**
* Verifies that the Jaeger tracer implementation can successfully use the adapter to inject and extract
* a SpanContext.
*/
@Test
public void testJaegerTracerCanUseAdapter() {
final Configuration config = new Configuration("test");
final Tracer tracer = config.getTracer();
final Span span = tracer.buildSpan("do").start();
final JsonObject jsonObject = new JsonObject();
final JsonObjectInjectAdapter injectAdapter = new JsonObjectInjectAdapter(jsonObject);
tracer.inject(span.context(), Format.Builtin.TEXT_MAP, injectAdapter);
final SpanContext context = tracer.extract(Format.Builtin.TEXT_MAP, new JsonObjectExtractAdapter(jsonObject));
assertThat(context.toSpanId()).isEqualTo(span.context().toSpanId());
}
use of io.jaegertracing.Configuration in project wildfly by wildfly.
the class JaegerTracerConfiguration method createConfiguration.
/**
* For testing purpose only.
* @param serviceName
* @return the jaeger tracer configuration.
*/
Configuration createConfiguration(String serviceName) {
Configuration.SenderConfiguration senderConfiguration = reporterConfig.getSenderConfiguration();
OutboundSocketBinding outboundSocketBinding = outboundSocketBindingSupplier.get();
if (outboundSocketBinding != null) {
senderConfiguration.withAgentHost(outboundSocketBinding.getUnresolvedDestinationAddress()).withAgentPort(outboundSocketBinding.getDestinationPort());
}
return new Configuration(serviceName).withCodec(codecConfig).withReporter(reporterConfig).withSampler(samplerConfig).withTraceId128Bit(traceId128Bit).withTracerTags(tracerTags);
}
use of io.jaegertracing.Configuration in project wildfly by wildfly.
the class JaegerTracerConfigurationTest method testModelResolution.
@Test
public void testModelResolution() throws OperationFailedException {
ModelNode operation = Operations.createAddOperation(PathAddress.pathAddress("subsystem", "microprofile-opentracing-smallrye").append("jaeger-tracer", "jaeger").toModelNode());
operation.get("propagation").add("B3").add(new ValueExpression("${jaeger.propagation:JAEGER}"));
operation.get("sampler-type").set(new ValueExpression("${jaeger.sampler.type:const}"));
operation.get("sampler-param").set(new ValueExpression("${jaeger.sampler-param:0.8}"));
operation.get("sampler-manager-host-port").set(new ValueExpression("${jaeger.sampler-manager-host-port:localhost:4321}"));
operation.get("sender-endpoint").set(new ValueExpression("${jaeger.sender.endpoint:http://localhost:14268/api/traces}"));
operation.get("sender-auth-token").set(new ValueExpression("${jaeger.sender.auth-token:myAuthToken}"));
operation.get("sender-auth-user").set(new ValueExpression("${jaeger.sender.user:sender}"));
operation.get("sender-auth-password").set(new ValueExpression("${jaeger.sender.password:senderPassword}"));
operation.get("reporter-log-spans").set(new ValueExpression("${jaeger.reporter.log-spans:false}"));
operation.get("reporter-flush-interval").set(new ValueExpression("${jaeger.reporter.flush-interval:5}"));
operation.get("reporter-max-queue-size").set(new ValueExpression("${jaeger.reporter.max-queue-size:10}"));
operation.get("tracer_id_128bit").set(new ValueExpression("${jaeger.tracer_id_128bit:true}"));
operation.get("tags").add("test", "${jaeger.reporter.max-queue-sizesimple}");
JaegerTracerConfiguration tracerConfiguration = new JaegerTracerConfiguration(ExpressionResolver.TEST_RESOLVER, "jaeger", operation, () -> null);
Configuration config = tracerConfiguration.createConfiguration("myApplication.war");
Assert.assertEquals(2, config.getCodec().getCodecs().size());
Assert.assertEquals(1, config.getCodec().getBinaryCodecs().size());
Assert.assertEquals(2, config.getCodec().getCodecs().get(Format.Builtin.HTTP_HEADERS).size());
Assert.assertEquals(2, config.getCodec().getCodecs().get(Format.Builtin.TEXT_MAP).size());
Assert.assertEquals(1, config.getCodec().getBinaryCodecs().get(Format.Builtin.BINARY).size());
Assert.assertEquals("const", config.getSampler().getType());
Assert.assertEquals(0.8d, config.getSampler().getParam().doubleValue(), 0.01);
Assert.assertEquals("localhost:4321", config.getSampler().getManagerHostPort());
Assert.assertEquals("http://localhost:14268/api/traces", config.getReporter().getSenderConfiguration().getEndpoint());
Assert.assertEquals("myAuthToken", config.getReporter().getSenderConfiguration().getAuthToken());
Assert.assertEquals("sender", config.getReporter().getSenderConfiguration().getAuthUsername());
Assert.assertEquals("senderPassword", config.getReporter().getSenderConfiguration().getAuthPassword());
Assert.assertEquals(false, config.getReporter().getLogSpans());
Assert.assertEquals(5, config.getReporter().getFlushIntervalMs().intValue());
Assert.assertEquals(10, config.getReporter().getMaxQueueSize().intValue());
}
Aggregations