Updated Jaeger from 0.27.0 to 1.8.1 - However OpenTracing is discontinued now, and this example becomes unuseful Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
diff --git a/examples/open-tracing/pom.xml b/examples/open-tracing/pom.xml index d6afe57..58660e6 100644 --- a/examples/open-tracing/pom.xml +++ b/examples/open-tracing/pom.xml
@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - + Copyright 2026 Contributors to the Eclipse Foundation. Copyright (c) 2017, 2025 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the @@ -43,44 +43,31 @@ <groupId>io.opentracing</groupId> <artifactId>opentracing-api</artifactId> </dependency> - <dependency> <groupId>io.opentracing</groupId> <artifactId>opentracing-util</artifactId> </dependency> <dependency> - <groupId>com.uber.jaeger</groupId> + <groupId>io.jaegertracing</groupId> <artifactId>jaeger-core</artifactId> - <version>${com.uber.jaeger.version}</version> + <version>${jaeger.version}</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - </exclusion> - <exclusion> - <groupId>io.opentracing</groupId> - <artifactId>opentracing-api</artifactId> - </exclusion> - <exclusion> - <groupId>io.opentracing</groupId> - <artifactId>opentracing-util</artifactId> + <artifactId>*</artifactId> </exclusion> <exclusion> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </exclusion> - <exclusion> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </exclusion> </exclusions> </dependency> - + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>${slf4j.version}</version> + </dependency> <dependency> <groupId>org.glassfish.jersey.test-framework</groupId>
diff --git a/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java b/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java index c92f440..cd092f7 100644 --- a/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java +++ b/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java
@@ -1,4 +1,5 @@ /* + * Copyright (c) 2026 Contributors to the Eclipse Foundation. * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -10,10 +11,12 @@ package org.glassfish.jersey.examples.opentracing; -import java.io.IOException; -import java.net.URI; -import java.util.logging.Level; -import java.util.logging.Logger; +import io.jaegertracing.Configuration; +import io.jaegertracing.Configuration.ReporterConfiguration; +import io.jaegertracing.Configuration.SamplerConfiguration; +import io.jaegertracing.Configuration.SenderConfiguration; +import io.opentracing.Span; +import io.opentracing.util.GlobalTracer; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.client.ClientBuilder; @@ -22,20 +25,18 @@ import jakarta.ws.rs.container.ContainerResponseContext; import jakarta.ws.rs.container.ContainerResponseFilter; +import java.io.IOException; +import java.net.URI; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.opentracing.OpenTracingFeature; import org.glassfish.jersey.opentracing.OpenTracingUtils; import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.grizzly.http.server.HttpServer; - -import com.uber.jaeger.Configuration; - -import io.opentracing.Span; -import io.opentracing.util.GlobalTracer; - /** - * Open tracing example application. * <p> * Exposes OpenTracing-enabled REST application (with Jaeger registered as the Tracer) * and invokes one request from (also OpenTracing-enabled) Jersey client. @@ -89,18 +90,17 @@ * Configures Jaeger tracer as the {@link GlobalTracer}. */ private static void prepare() { - GlobalTracer.register( - new com.uber.jaeger.Configuration( - "OpenTracingTemporaryTest", - new Configuration.SamplerConfiguration("const", 1), - new Configuration.ReporterConfiguration( - true, - "localhost", - 5775, - 1000, - 10000) - ).getTracer() - ); + SamplerConfiguration sampler = new SamplerConfiguration().withType("const").withParam(1); + SenderConfiguration sender = new SenderConfiguration().withAgentHost("localhost").withAgentPort(5775); + ReporterConfiguration reporter = new ReporterConfiguration() + .withLogSpans(true) + .withFlushInterval(1000) + .withMaxQueueSize(10000) + .withSender(sender); + Configuration configuration = new Configuration("OpenTracingTemporaryTest") + .withSampler(sampler) + .withReporter(reporter); + GlobalTracer.registerIfAbsent(configuration.getTracer()); } /**
diff --git a/pom.xml b/pom.xml index 889be49..2dc5df6 100644 --- a/pom.xml +++ b/pom.xml
@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - + Copyright 2026 Contributors to the Eclipse Foundation. Copyright (c) 2010, 2025 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the @@ -2197,11 +2197,8 @@ <groovy.version>5.0.0-alpha-12</groovy.version> <gson.version>2.13.1</gson.version> - <!--versions, extracted here due to maven-enforcer-plugin --> - <!-- <commons.codec.version>1.15</commons.codec.version>--> - <com.uber.jaeger.version>0.27.0</com.uber.jaeger.version> + <jaeger.version>1.8.1</jaeger.version> <org.codehaus.gmavenplus.version>4.2.0</org.codehaus.gmavenplus.version> - <!-- end of versions extracted here due to maven-enforcer-plugin --> <!-- micrometer --> <micrometer.version>1.15.1</micrometer.version>