From 5e77f247b67352969964526e6d0e900fc01ed662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20L=C3=B6fgren?= Date: Wed, 5 May 2021 17:54:46 +0200 Subject: [PATCH 1/2] Bump jaeger client Fixes #121 See jaegertracing/jaeger-client-java#768 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fb3ea76..78f0508 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 0.4.0 4.0.0 2.3.4.RELEASE - 1.3.2 + 1.6.0 3.0.0 1.7.3 From 9df32a835dd5612bf026c79a7697f50a2fcf3382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20L=C3=B6fgren?= Date: Wed, 5 May 2021 18:25:17 +0200 Subject: [PATCH 2/2] Add throws for new Exception from Jaeger client Also fix assert to not strip leading zeros, see jaegertracing/jaeger-client-java#746 --- .../spring/jaeger/starter/JaegerAutoConfiguration.java | 7 ++++--- .../JaegerTracerB3CustomizerCustomSpringTest.java | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/opentracing-spring-jaeger-starter/src/main/java/io/opentracing/contrib/java/spring/jaeger/starter/JaegerAutoConfiguration.java b/opentracing-spring-jaeger-starter/src/main/java/io/opentracing/contrib/java/spring/jaeger/starter/JaegerAutoConfiguration.java index da587c1..a7a779d 100644 --- a/opentracing-spring-jaeger-starter/src/main/java/io/opentracing/contrib/java/spring/jaeger/starter/JaegerAutoConfiguration.java +++ b/opentracing-spring-jaeger-starter/src/main/java/io/opentracing/contrib/java/spring/jaeger/starter/JaegerAutoConfiguration.java @@ -37,6 +37,7 @@ import java.util.LinkedList; import java.util.List; +import org.apache.thrift.transport.TTransportException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -83,7 +84,7 @@ public io.opentracing.Tracer tracer(Sampler sampler, @Bean public Reporter reporter(JaegerConfigurationProperties properties, Metrics metrics, - @Autowired(required = false) ReporterAppender reporterAppender) { + @Autowired(required = false) ReporterAppender reporterAppender) throws TTransportException { List reporters = new LinkedList<>(); RemoteReporter remoteReporter = properties.getRemoteReporter(); @@ -108,7 +109,7 @@ public Reporter reporter(JaegerConfigurationProperties properties, private Reporter getUdpReporter(Metrics metrics, RemoteReporter remoteReporter, - JaegerConfigurationProperties.UdpSender udpSenderProperties) { + JaegerConfigurationProperties.UdpSender udpSenderProperties) throws TTransportException { io.jaegertracing.thrift.internal.senders.UdpSender udpSender = new io.jaegertracing.thrift.internal.senders.UdpSender( udpSenderProperties.getHost(), udpSenderProperties.getPort(), @@ -119,7 +120,7 @@ private Reporter getUdpReporter(Metrics metrics, private Reporter getHttpReporter(Metrics metrics, RemoteReporter remoteReporter, - JaegerConfigurationProperties.HttpSender httpSenderProperties) { + JaegerConfigurationProperties.HttpSender httpSenderProperties) throws TTransportException { io.jaegertracing.thrift.internal.senders.HttpSender.Builder builder = new io.jaegertracing.thrift.internal.senders.HttpSender.Builder(httpSenderProperties.getUrl()); if (httpSenderProperties.getMaxPayload() != null) { diff --git a/opentracing-spring-jaeger-starter/src/test/java/io/opentracing/contrib/java/spring/jaeger/starter/customizer/JaegerTracerB3CustomizerCustomSpringTest.java b/opentracing-spring-jaeger-starter/src/test/java/io/opentracing/contrib/java/spring/jaeger/starter/customizer/JaegerTracerB3CustomizerCustomSpringTest.java index 8018ff0..33e2eca 100644 --- a/opentracing-spring-jaeger-starter/src/test/java/io/opentracing/contrib/java/spring/jaeger/starter/customizer/JaegerTracerB3CustomizerCustomSpringTest.java +++ b/opentracing-spring-jaeger-starter/src/test/java/io/opentracing/contrib/java/spring/jaeger/starter/customizer/JaegerTracerB3CustomizerCustomSpringTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2018-2019 The OpenTracing Authors + * Copyright 2018-2021 The OpenTracing Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -84,7 +84,7 @@ private void assertOnB3Headers(JaegerSpanContext context) { // Note: This test ensures that B3 codec actually works // If it would not, values would never be extracted from B3 headers and context will be null assertThat(context).isNotNull(); - assertThat(context.getTraceId()).isEqualTo("abc"); + assertThat(context.getTraceId()).isEqualTo("0000000000000abc"); assertThat(context.getSpanId()).isEqualTo(3567L); } }