Skip to content

Commit e6377ec

Browse files
adinauerclaude
andauthored
build(opentelemetry): Bump OpenTelemetry dependencies (#5225)
* build(opentelemetry): Bump OpenTelemetry dependencies Update OpenTelemetry core, instrumentation, and semantic conventions\nversions in the shared version catalog.\n\nThis keeps sentry-java aligned with newer OTel releases used by the\nopentelemetry modules and samples.\n\nCo-Authored-By: Claude <noreply@anthropic.com> * changelog * docs(changelog): Clarify OpenTelemetry bump versions Align the OpenTelemetry changelog entry with prior dependency bump style\nby listing each artifact and including previous versions for context.\n\nThis makes the upgrade scope easier to review and mirrors the detail\nlevel used in earlier OpenTelemetry changelog entries.\n\nCo-Authored-By: Claude <noreply@anthropic.com> * ci(e2e): Enable Spring Boot 4 no-agent system tests Enable the spring-boot-4 opentelemetry-noagent sample in backend system-test matrix and spring-boot-4 workflow. This turns the previously commented-out no-agent scenario into an active CI check so regressions are caught automatically. Co-Authored-By: Claude <noreply@anthropic.com> * fix(opentelemetry): Use stable Attributes API in core tests Replace test usage of sdk.internal.AttributesMap with public Attributes builders.\n\nThe OTel dependency bump removed the internal class, which broke\n:sentry-opentelemetry:sentry-opentelemetry-core:compileTestKotlin and\ntherefore the full build. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e2dce0b commit e6377ec

File tree

7 files changed

+80
-28
lines changed

7 files changed

+80
-28
lines changed

.github/workflows/spring-boot-4-matrix.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,13 @@ jobs:
132132
--auto-init "false" \
133133
--build "true"
134134
135-
# needs a fix in opentelemetry-spring-boot-starter
136-
# - name: Run sentry-samples-spring-boot-4-opentelemetry-noagent
137-
# run: |
138-
# python3 test/system-test-runner.py test \
139-
# --module "sentry-samples-spring-boot-4-opentelemetry-noagent" \
140-
# --agent false \
141-
# --auto-init "true" \
142-
# --build "true"
135+
- name: Run sentry-samples-spring-boot-4-opentelemetry-noagent
136+
run: |
137+
python3 test/system-test-runner.py test \
138+
--module "sentry-samples-spring-boot-4-opentelemetry-noagent" \
139+
--agent false \
140+
--auto-init "true" \
141+
--build "true"
143142
144143
- name: Run sentry-samples-spring-7
145144
run: |

.github/workflows/system-tests-backend.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ jobs:
7272
- sample: "sentry-samples-spring-boot-4-webflux"
7373
agent: "false"
7474
agent-auto-init: "true"
75-
# - sample: "sentry-samples-spring-boot-4-opentelemetry-noagent"
76-
# agent: "false"
77-
# agent-auto-init: "true"
75+
- sample: "sentry-samples-spring-boot-4-opentelemetry-noagent"
76+
agent: "false"
77+
agent-auto-init: "true"
7878
- sample: "sentry-samples-spring-boot-4-opentelemetry"
7979
agent: "true"
8080
agent-auto-init: "true"

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
}
2020
```
2121

22+
### Dependencies
23+
24+
- Bump OpenTelemetry ([#5225](https://github.com/getsentry/sentry-java/pull/5225))
25+
- `opentelemetry` to `1.60.1` (was `1.57.0`)
26+
- `opentelemetry-instrumentation` to `2.26.0` (was `2.23.0`)
27+
- `opentelemetry-instrumentation-alpha` to `2.26.0-alpha` (was `2.23.0-alpha`)
28+
- `opentelemetry-semconv` to `1.40.0` (was `1.37.0`)
29+
- `opentelemetry-semconv-alpha` to `1.40.0-alpha` (was `1.37.0-alpha`)
30+
2231
## 8.36.0
2332

2433
### Features

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ nopen = "1.0.1"
2222
# see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility
2323
# see https://developer.android.com/jetpack/androidx/releases/compose-kotlin
2424
okhttp = "4.9.2"
25-
otel = "1.57.0"
26-
otelInstrumentation = "2.23.0"
27-
otelInstrumentationAlpha = "2.23.0-alpha"
25+
otel = "1.60.1"
26+
otelInstrumentation = "2.26.0"
27+
otelInstrumentationAlpha = "2.26.0-alpha"
2828
# check https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/dependencyManagement/build.gradle.kts#L49 for release version above to find a compatible version
29-
otelSemanticConventions = "1.37.0"
30-
otelSemanticConventionsAlpha = "1.37.0-alpha"
29+
otelSemanticConventions = "1.40.0"
30+
otelSemanticConventionsAlpha = "1.40.0-alpha"
3131
retrofit = "2.9.0"
3232
slf4j = "1.7.30"
3333
springboot2 = "2.7.18"

sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package io.sentry.opentelemetry
22

33
import io.opentelemetry.api.common.AttributeKey
4-
import io.opentelemetry.sdk.internal.AttributesMap
5-
import io.opentelemetry.sdk.trace.SpanLimits
4+
import io.opentelemetry.api.common.Attributes
65
import io.opentelemetry.sdk.trace.data.SpanData
76
import io.opentelemetry.semconv.HttpAttributes
87
import io.opentelemetry.semconv.ServerAttributes
@@ -22,12 +21,12 @@ import org.mockito.kotlin.whenever
2221
class OpenTelemetryAttributesExtractorTest {
2322
private class Fixture {
2423
val spanData = mock<SpanData>()
25-
val attributes = AttributesMap.create(100, SpanLimits.getDefault().maxAttributeValueLength)
24+
var attributes: Attributes = Attributes.empty()
2625
val options = SentryOptions.empty()
2726
val scope = Scope(options)
2827

2928
init {
30-
whenever(spanData.attributes).thenReturn(attributes)
29+
whenever(spanData.attributes).thenAnswer { attributes }
3130
}
3231
}
3332

@@ -346,7 +345,22 @@ class OpenTelemetryAttributesExtractorTest {
346345
}
347346

348347
private fun givenAttributes(map: Map<AttributeKey<out Any>, Any>) {
349-
map.forEach { k, v -> fixture.attributes.put(k, v) }
348+
fixture.attributes = buildAttributes(map)
349+
}
350+
351+
private fun buildAttributes(map: Map<AttributeKey<out Any>, Any>): Attributes {
352+
val builder = Attributes.builder()
353+
map.forEach { (key, value) -> putAttribute(builder, key, value) }
354+
return builder.build()
355+
}
356+
357+
@Suppress("UNCHECKED_CAST")
358+
private fun putAttribute(
359+
builder: io.opentelemetry.api.common.AttributesBuilder,
360+
key: AttributeKey<out Any>,
361+
value: Any,
362+
) {
363+
builder.put(key as AttributeKey<Any>, value)
350364
}
351365

352366
private fun whenExtractingAttributes() {

sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.sentry.opentelemetry
22

33
import io.opentelemetry.api.common.AttributeKey
4+
import io.opentelemetry.api.common.Attributes
45
import io.opentelemetry.api.trace.SpanKind
5-
import io.opentelemetry.sdk.internal.AttributesMap
66
import io.opentelemetry.semconv.HttpAttributes
77
import io.opentelemetry.semconv.ServerAttributes
88
import io.opentelemetry.semconv.UrlAttributes
@@ -17,7 +17,7 @@ import org.mockito.kotlin.whenever
1717
class OtelInternalSpanDetectionUtilTest {
1818
private class Fixture {
1919
val scopes = mock<IScopes>()
20-
val attributes = AttributesMap.create(100, 100)
20+
var attributes: Attributes = Attributes.empty()
2121
val options = SentryOptions.empty()
2222
var spanKind: SpanKind = SpanKind.INTERNAL
2323

@@ -152,7 +152,22 @@ class OtelInternalSpanDetectionUtilTest {
152152
}
153153

154154
private fun givenAttributes(map: Map<AttributeKey<out Any>, Any>) {
155-
map.forEach { k, v -> fixture.attributes.put(k, v) }
155+
fixture.attributes = buildAttributes(map)
156+
}
157+
158+
private fun buildAttributes(map: Map<AttributeKey<out Any>, Any>): Attributes {
159+
val builder = Attributes.builder()
160+
map.forEach { (key, value) -> putAttribute(builder, key, value) }
161+
return builder.build()
162+
}
163+
164+
@Suppress("UNCHECKED_CAST")
165+
private fun putAttribute(
166+
builder: io.opentelemetry.api.common.AttributesBuilder,
167+
key: AttributeKey<out Any>,
168+
value: Any,
169+
) {
170+
builder.put(key as AttributeKey<Any>, value)
156171
}
157172

158173
private fun givenDsn(dsn: String) {

sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package io.sentry.opentelemetry
22

33
import io.opentelemetry.api.common.AttributeKey
4+
import io.opentelemetry.api.common.Attributes
45
import io.opentelemetry.api.trace.SpanContext
56
import io.opentelemetry.api.trace.SpanKind
67
import io.opentelemetry.api.trace.TraceFlags
78
import io.opentelemetry.api.trace.TraceState
8-
import io.opentelemetry.sdk.internal.AttributesMap
99
import io.opentelemetry.sdk.trace.data.SpanData
1010
import io.opentelemetry.semconv.HttpAttributes
1111
import io.opentelemetry.semconv.UrlAttributes
@@ -22,14 +22,14 @@ class SpanDescriptionExtractorTest {
2222
private class Fixture {
2323
val sentrySpan = mock<IOtelSpanWrapper>()
2424
val otelSpan = mock<SpanData>()
25-
val attributes = AttributesMap.create(100, 100)
25+
var attributes: Attributes = Attributes.empty()
2626
var parentSpanContext = SpanContext.getInvalid()
2727
var spanKind = SpanKind.INTERNAL
2828
var spanName: String? = null
2929
var spanDescription: String? = null
3030

3131
fun setup() {
32-
whenever(otelSpan.attributes).thenReturn(attributes)
32+
whenever(otelSpan.attributes).thenAnswer { attributes }
3333
whenever(otelSpan.parentSpanContext).thenReturn(parentSpanContext)
3434
whenever(otelSpan.kind).thenReturn(spanKind)
3535
spanName?.let { whenever(otelSpan.name).thenReturn(it) }
@@ -271,7 +271,22 @@ class SpanDescriptionExtractorTest {
271271
}
272272

273273
private fun givenAttributes(map: Map<AttributeKey<out Any>, Any>) {
274-
map.forEach { k, v -> fixture.attributes.put(k, v) }
274+
fixture.attributes = buildAttributes(map)
275+
}
276+
277+
private fun buildAttributes(map: Map<AttributeKey<out Any>, Any>): Attributes {
278+
val builder = Attributes.builder()
279+
map.forEach { (key, value) -> putAttribute(builder, key, value) }
280+
return builder.build()
281+
}
282+
283+
@Suppress("UNCHECKED_CAST")
284+
private fun putAttribute(
285+
builder: io.opentelemetry.api.common.AttributesBuilder,
286+
key: AttributeKey<out Any>,
287+
value: Any,
288+
) {
289+
builder.put(key as AttributeKey<Any>, value)
275290
}
276291

277292
private fun whenExtractingSpanInfo(): OtelSpanInfo {

0 commit comments

Comments
 (0)