Skip to content

Commit f18a3e8

Browse files
authored
Adopt later OpenTelemetry release (helidon-io#11066)
1 parent 2f2b682 commit f18a3e8

17 files changed

Lines changed: 149 additions & 54 deletions

File tree

archetypes/archetypes/src/main/archetype/mp/custom/tracing-outputs.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2023 Oracle and/or its affiliates.
4+
Copyright (c) 2023, 2026 Oracle and/or its affiliates.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -26,9 +26,10 @@
2626
<list key="dependencies">
2727
<map order="800">
2828
<value key="groupId">io.opentelemetry</value>
29-
<value key="artifactId">opentelemetry-exporter-jaeger</value>
29+
<value key="artifactId">opentelemetry-exporter-otlp</value>
3030
</map>
3131
</list>
32+
<value key="tracing.provider.for.otel">otlp</value>
3233
</model>
3334
</output>
3435
</method>
@@ -41,6 +42,7 @@
4142
<value key="artifactId">opentelemetry-exporter-zipkin</value>
4243
</map>
4344
</list>
45+
<value key="tracing.provider.for.otel">zipkin</value>
4446
</model>
4547
</output>
4648
</method>
@@ -65,7 +67,7 @@
6567
<value template="mustache"><![CDATA[
6668
#OpenTelemetry
6769
otel.sdk.disabled=false
68-
otel.traces.exporter={{tracing.provider}}
70+
otel.traces.exporter={{tracing.provider.for.otel}}
6971
otel.service.name=helidon-tracing-service]]></value>
7072
</list>
7173
<list key="module-requires">

dependencies/pom.xml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,15 @@
142142
<version.lib.ojdbc.family>23</version.lib.ojdbc.family>
143143
<version.lib.ojdbc>${version.lib.ojdbc.family}.26.0.0.0</version.lib.ojdbc>
144144
<version.lib.ojdbc8>${version.lib.ojdbc}</version.lib.ojdbc8>
145+
<!-- Force upgrade of okio for dependency convergence: make the OTel otlp exporter use the release langchain4j uses -->
146+
<version.lib.okio>3.6.0</version.lib.okio>
145147
<!-- Force upgrade okhttp3 for dependency convergence -->
146148
<version.lib.okhttp3>4.12.0</version.lib.okhttp3>
147-
<version.lib.opentelemetry.semconv>1.29.0-alpha</version.lib.opentelemetry.semconv>
148-
<version.lib.opentelemetry-sdk-extension-autoconfigure>1.29.0</version.lib.opentelemetry-sdk-extension-autoconfigure>
149-
<version.lib.opentelemetry.opentracing.shim>1.29.0</version.lib.opentelemetry.opentracing.shim>
150-
<version.lib.opentelemetry>1.29.0</version.lib.opentelemetry>
149+
<version.lib.opentelemetry.semconv>1.37.0</version.lib.opentelemetry.semconv>
150+
<version.lib.opentelemetry-sdk-extension-autoconfigure>1.58.0</version.lib.opentelemetry-sdk-extension-autoconfigure>
151+
<version.lib.opentelemetry.opentracing.shim>1.58.0</version.lib.opentelemetry.opentracing.shim>
152+
<version.lib.opentelemetry>1.58.0</version.lib.opentelemetry>
153+
<version.lib.opentelemetry.instrumentation.annotations>2.24.0</version.lib.opentelemetry.instrumentation.annotations>
151154
<version.lib.opentracing>0.33.0</version.lib.opentracing>
152155
<version.lib.opentracing.grpc>0.2.1</version.lib.opentracing.grpc>
153156
<version.lib.opentracing.tracerresolver>0.1.8</version.lib.opentracing.tracerresolver>
@@ -247,7 +250,7 @@
247250
</exclusions>
248251
</dependency>
249252
<dependency>
250-
<groupId>io.opentelemetry</groupId>
253+
<groupId>io.opentelemetry.semconv</groupId>
251254
<artifactId>opentelemetry-semconv</artifactId>
252255
<version>${version.lib.opentelemetry.semconv}</version>
253256
</dependency>
@@ -270,7 +273,7 @@
270273
<dependency>
271274
<groupId>io.opentelemetry.instrumentation</groupId>
272275
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
273-
<version>${version.lib.opentelemetry}</version>
276+
<version>${version.lib.opentelemetry.instrumentation.annotations}</version>
274277
</dependency>
275278
<dependency>
276279
<groupId>io.opentelemetry.instrumentation</groupId>
@@ -1231,6 +1234,12 @@
12311234
<artifactId>okhttp</artifactId>
12321235
<version>${version.lib.okhttp3}</version>
12331236
</dependency>
1237+
<dependency>
1238+
<!-- For dependency convergence -->
1239+
<groupId>com.squareup.okio</groupId>
1240+
<artifactId>okio</artifactId>
1241+
<version>${version.lib.okio}</version>
1242+
</dependency>
12341243
<!-- END OF Section 3: transitive dependencies we manage the version of for convergence/upgrade -->
12351244

12361245
<!-- Section 4: Testing -->

microprofile/telemetry/src/main/java/io/helidon/microprofile/telemetry/HelidonTelemetryClientFilter.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2026 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929

3030
import io.opentelemetry.api.baggage.Baggage;
3131
import io.opentelemetry.context.Context;
32+
import io.opentelemetry.semconv.ServerAttributes;
3233
import jakarta.enterprise.inject.Instance;
3334
import jakarta.inject.Inject;
3435
import jakarta.ws.rs.client.ClientRequestContext;
@@ -42,8 +43,8 @@
4243
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.HTTP_METHOD;
4344
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.HTTP_SCHEME;
4445
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.HTTP_STATUS_CODE;
45-
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_NAME;
46-
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_PORT;
46+
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.NET_PEER_NAME;
47+
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.NET_PEER_PORT;
4748

4849
/**
4950
* Filter to process Client request and Client response. Starts a new {@link io.opentelemetry.api.trace.Span} on request and
@@ -96,8 +97,11 @@ public void filter(ClientRequestContext clientRequestContext) {
9697
.tag(HTTP_METHOD, clientRequestContext.getMethod())
9798
.tag(HTTP_SCHEME, clientRequestContext.getUri().getScheme())
9899
.tag(HTTP_URL, clientRequestContext.getUri().toString())
99-
.tag(NET_PEER_NAME.getKey(), clientRequestContext.getUri().getHost())
100-
.tag(NET_PEER_PORT.getKey(), clientRequestContext.getUri().getPort())
100+
.tag(ServerAttributes.SERVER_ADDRESS.getKey(), clientRequestContext.getUri().getHost())
101+
.tag(ServerAttributes.SERVER_PORT.getKey(), clientRequestContext.getUri().getPort())
102+
.tag(NET_PEER_NAME, clientRequestContext.getUri().getHost())
103+
.tag(NET_PEER_PORT, clientRequestContext.getUri().getPort())
104+
101105
.update(builder -> Span.current()
102106
.map(Span::context)
103107
.ifPresent(builder::parent))

microprofile/telemetry/src/main/java/io/helidon/microprofile/telemetry/HelidonTelemetryConstants.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2026 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,4 +27,18 @@ private HelidonTelemetryConstants() {
2727
static final String HTTP_STATUS_CODE = "http.status_code";
2828
static final String HTTP_METHOD = "http.method";
2929
static final String HTTP_SCHEME = "http.scheme";
30+
31+
// The following are for maintaining compatibility with MicroProfile Telemetry 1.x.
32+
@Deprecated(since = "4.4.0", forRemoval = true)
33+
static final String NET_HOST_NAME = "net.host.name";
34+
35+
@Deprecated(since = "4.4.0", forRemoval = true)
36+
static final String NET_HOST_PORT = "net.host.port";
37+
38+
@Deprecated(since = "4.4.0", forRemoval = true)
39+
static final String NET_PEER_NAME = "net.peer.name";
40+
41+
@Deprecated(since = "4.4.0", forRemoval = true)
42+
static final String NET_PEER_PORT = "net.peer.port";
43+
// end of compatibility
3044
}

microprofile/telemetry/src/main/java/io/helidon/microprofile/telemetry/HelidonTelemetryContainerFilter.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2026 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@
3232
import io.opentelemetry.api.baggage.Baggage;
3333
import io.opentelemetry.api.baggage.BaggageEntryMetadata;
3434
import io.opentelemetry.context.Context;
35-
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
35+
import io.opentelemetry.semconv.ServerAttributes;
3636
import jakarta.enterprise.inject.Instance;
3737
import jakarta.inject.Inject;
3838
import jakarta.ws.rs.ApplicationPath;
@@ -50,6 +50,8 @@
5050
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.HTTP_METHOD;
5151
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.HTTP_SCHEME;
5252
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.HTTP_STATUS_CODE;
53+
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.NET_HOST_NAME;
54+
import static io.helidon.microprofile.telemetry.HelidonTelemetryConstants.NET_HOST_PORT;
5355

5456
/**
5557
* Filter to process Server request and Server response. Starts a new {@link io.opentelemetry.api.trace.Span} on request and
@@ -147,8 +149,11 @@ public void filter(ContainerRequestContext requestContext) {
147149
.tag(HTTP_SCHEME, requestContext.getUriInfo().getRequestUri().getScheme())
148150
.tag(HTTP_TARGET, resolveTarget(requestContext))
149151
.tag(HTTP_ROUTE, route)
150-
.tag(SemanticAttributes.NET_HOST_NAME.getKey(), requestContext.getUriInfo().getBaseUri().getHost())
151-
.tag(SemanticAttributes.NET_HOST_PORT.getKey(), requestContext.getUriInfo().getBaseUri().getPort())
152+
.tag(ServerAttributes.SERVER_ADDRESS.getKey(), requestContext.getUriInfo().getBaseUri().getHost())
153+
.tag(ServerAttributes.SERVER_PORT.getKey(), requestContext.getUriInfo().getBaseUri().getPort())
154+
.tag(NET_HOST_NAME, requestContext.getUriInfo().getBaseUri().getHost())
155+
.tag(NET_HOST_PORT, requestContext.getUriInfo().getBaseUri().getPort())
156+
152157
.update(builder -> parentSpanContext.ifPresent(builder::parent))
153158
.start();
154159

microprofile/telemetry/src/main/java/io/helidon/microprofile/telemetry/TelemetryCdiExtension.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ public SpanKind kind() {
119119
public Class<? extends Annotation> annotationType() {
120120
return WithSpan.class;
121121
}
122+
123+
@Override
124+
public boolean inheritContext() {
125+
return true;
126+
}
122127
});
123128

124129
for (AnnotatedParameterConfigurator<?> param : method.params()) {

microprofile/telemetry/src/main/java/module-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2026 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@
4444
requires jakarta.annotation;
4545
requires jakarta.inject;
4646
requires microprofile.config.api;
47-
requires opentelemetry.instrumentation.annotations;
47+
requires io.opentelemetry.instrumentation_annotations;
4848
requires io.opentelemetry.semconv;
4949

5050
requires static io.helidon.common.features.api;

telemetry/opentelemetry-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<artifactId>opentelemetry-sdk-trace</artifactId>
7474
</dependency>
7575
<dependency>
76-
<groupId>io.opentelemetry</groupId>
76+
<groupId>io.opentelemetry.semconv</groupId>
7777
<artifactId>opentelemetry-semconv</artifactId>
7878
</dependency>
7979
<dependency>

telemetry/opentelemetry-config/src/main/java/io/helidon/telemetry/otelconfig/OpenTelemetryConfigSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025 Oracle and/or its affiliates.
2+
* Copyright (c) 2025, 2026 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
2828
import io.opentelemetry.context.propagation.TextMapPropagator;
2929
import io.opentelemetry.sdk.OpenTelemetrySdk;
3030
import io.opentelemetry.sdk.resources.Resource;
31-
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
31+
import io.opentelemetry.semconv.ServiceAttributes;
3232

3333
final class OpenTelemetryConfigSupport {
3434

@@ -49,7 +49,7 @@ private static OpenTelemetry openTelemetry(OpenTelemetryConfig.BuilderBase<?, ?>
4949
var sdkTracerProviderBuilder = tracingBuilderInfo.sdkTracerProviderBuilder();
5050

5151
var attributesBuilder = tracingConfig.tracingBuilderInfo().attributesBuilder();
52-
attributesBuilder.put(ResourceAttributes.SERVICE_NAME, target.service().orElseThrow());
52+
attributesBuilder.put(ServiceAttributes.SERVICE_NAME, target.service().orElseThrow());
5353

5454
var resource = Resource.getDefault().merge(Resource.create(attributesBuilder.build()));
5555
sdkTracerProviderBuilder.setResource(resource);

tracing/providers/jaeger/pom.xml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,21 @@
4343
</dependency>
4444
<dependency>
4545
<groupId>io.opentelemetry</groupId>
46-
<artifactId>opentelemetry-exporter-jaeger</artifactId>
46+
<artifactId>opentelemetry-extension-trace-propagators</artifactId>
47+
</dependency>
48+
<dependency>
49+
<groupId>io.opentelemetry.semconv</groupId>
50+
<artifactId>opentelemetry-semconv</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>io.opentelemetry</groupId>
54+
<artifactId>opentelemetry-exporter-otlp</artifactId>
55+
<exclusions>
56+
<exclusion>
57+
<groupId>io.opentelemetry</groupId>
58+
<artifactId>opentelemetry-exporter-sender-okhttp</artifactId>
59+
</exclusion>
60+
</exclusions>
4761
</dependency>
4862
<dependency>
4963
<groupId>io.helidon.tracing.providers</groupId>
@@ -86,6 +100,17 @@
86100
<artifactId>helidon-config-metadata</artifactId>
87101
<optional>true</optional>
88102
</dependency>
103+
<dependency>
104+
<groupId>io.opentelemetry</groupId>
105+
<artifactId>opentelemetry-exporter-sender-grpc-managed-channel</artifactId>
106+
<version>${version.lib.opentelemetry}</version>
107+
<scope>runtime</scope>
108+
</dependency>
109+
<dependency>
110+
<groupId>io.grpc</groupId>
111+
<artifactId>grpc-okhttp</artifactId>
112+
<scope>runtime</scope>
113+
</dependency>
89114

90115
<!--
91116
- Test dependencies
@@ -97,11 +122,6 @@
97122
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
98123
<scope>test</scope>
99124
</dependency>
100-
<dependency>
101-
<groupId>io.opentelemetry</groupId>
102-
<artifactId>opentelemetry-exporter-otlp</artifactId>
103-
<scope>test</scope>
104-
</dependency>
105125
<!-- -->
106126

107127
<dependency>

0 commit comments

Comments
 (0)