Skip to content

Commit f2bb552

Browse files
authored
Merge d533746 into 0f37c1d
2 parents 0f37c1d + d533746 commit f2bb552

File tree

4 files changed

+26
-49
lines changed

4 files changed

+26
-49
lines changed

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ nopen = "1.0.1"
1919
# see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility
2020
# see https://developer.android.com/jetpack/androidx/releases/compose-kotlin
2121
okhttp = "4.9.2"
22-
otel = "1.44.1"
23-
otelInstrumentation = "2.10.0"
24-
otelInstrumentationAlpha = "2.10.0-alpha"
22+
otel = "1.51.0"
23+
otelInstrumentation = "2.17.0"
24+
otelInstrumentationAlpha = "2.17.0-alpha"
2525
# 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
26-
otelSemanticConventions = "1.28.0-alpha"
26+
otelSemanticConventions = "1.34.0-alpha"
2727
retrofit = "2.9.0"
2828
slf4j = "1.7.30"
2929
springboot2 = "2.7.18"

sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,13 @@ private static Map<String, String> collectHeaders(
105105
return headers;
106106
}
107107

108-
@SuppressWarnings("deprecation")
109108
public @Nullable String extractUrl(
110109
final @NotNull Attributes attributes, final @NotNull SentryOptions options) {
111110
final @Nullable String urlFull = attributes.get(UrlAttributes.URL_FULL);
112111
if (urlFull != null) {
113112
return urlFull;
114113
}
115114

116-
final @Nullable String deprecatedUrl =
117-
attributes.get(io.opentelemetry.semconv.SemanticAttributes.HTTP_URL);
118-
if (deprecatedUrl != null) {
119-
return deprecatedUrl;
120-
}
121-
122115
final String urlString = buildUrlString(attributes, options);
123116
if (!urlString.isEmpty()) {
124117
return urlString;

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package io.sentry.opentelemetry
22

33
import io.opentelemetry.api.common.AttributeKey
44
import io.opentelemetry.sdk.internal.AttributesMap
5+
import io.opentelemetry.sdk.trace.SpanLimits
56
import io.opentelemetry.sdk.trace.data.SpanData
67
import io.opentelemetry.semconv.HttpAttributes
7-
import io.opentelemetry.semconv.SemanticAttributes
88
import io.opentelemetry.semconv.ServerAttributes
99
import io.opentelemetry.semconv.UrlAttributes
1010
import io.sentry.Scope
1111
import io.sentry.SentryOptions
1212
import io.sentry.protocol.Request
13+
import java.util.UUID
1314
import kotlin.test.Test
1415
import kotlin.test.assertEquals
1516
import kotlin.test.assertFalse
@@ -21,7 +22,7 @@ import org.mockito.kotlin.whenever
2122
class OpenTelemetryAttributesExtractorTest {
2223
private class Fixture {
2324
val spanData = mock<SpanData>()
24-
val attributes = AttributesMap.create(100, 100)
25+
val attributes = AttributesMap.create(100, SpanLimits.getDefault().maxAttributeValueLength)
2526
val options = SentryOptions.empty()
2627
val scope = Scope(options)
2728

@@ -195,15 +196,6 @@ class OpenTelemetryAttributesExtractorTest {
195196
assertEquals("https://sentry.io/some/path", url)
196197
}
197198

198-
@Test
199-
fun `returns deprecated URL if present`() {
200-
givenAttributes(mapOf(SemanticAttributes.HTTP_URL to "https://sentry.io/some/path"))
201-
202-
val url = whenExtractingUrl()
203-
204-
assertEquals("https://sentry.io/some/path", url)
205-
}
206-
207199
@Test
208200
fun `returns reconstructed URL if attributes present`() {
209201
givenAttributes(
@@ -293,19 +285,30 @@ class OpenTelemetryAttributesExtractorTest {
293285

294286
@Test
295287
fun `sets server request headers based on OTel attributes and merges list of values`() {
296-
givenAttributes(
288+
val elements =
289+
"sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d"
290+
val listOf = listOf(elements, "another-baggage=abc,more=def")
291+
val pairs = AttributeKey.stringArrayKey("http.request.header.baggage") to listOf
292+
val map =
297293
mapOf(
298294
HttpAttributes.HTTP_REQUEST_METHOD to "GET",
299-
AttributeKey.stringArrayKey("http.request.header.baggage") to
300-
listOf(
301-
"sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d",
302-
"another-baggage=abc,more=def",
303-
),
295+
pairs,
304296
AttributeKey.stringArrayKey("http.request.header.sentry-trace") to
305297
listOf("f9118105af4a2d42b4124532cd176588-4542d085bb0b4de5"),
306-
AttributeKey.stringArrayKey("http.response.header.some-header") to listOf("some-value"),
298+
AttributeKey.stringArrayKey("http.response.header.some-header") to
299+
listOf(
300+
"some-value" +
301+
"__" +
302+
UUID.randomUUID().toString() +
303+
"__" +
304+
UUID.randomUUID().toString() +
305+
"__" +
306+
UUID.randomUUID().toString() +
307+
"__" +
308+
UUID.randomUUID().toString()
309+
),
307310
)
308-
)
311+
givenAttributes(map)
309312

310313
whenExtractingAttributes()
311314

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import io.opentelemetry.api.common.AttributeKey
44
import io.opentelemetry.api.trace.SpanKind
55
import io.opentelemetry.sdk.internal.AttributesMap
66
import io.opentelemetry.semconv.HttpAttributes
7-
import io.opentelemetry.semconv.SemanticAttributes
87
import io.opentelemetry.semconv.ServerAttributes
98
import io.opentelemetry.semconv.UrlAttributes
109
import io.sentry.IScopes
@@ -56,15 +55,6 @@ class OtelInternalSpanDetectionUtilTest {
5655
thenRequestIsConsideredInternal()
5756
}
5857

59-
@Test
60-
fun `detects deprecated url as internal (span kind client)`() {
61-
givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1")
62-
givenSpanKind(SpanKind.CLIENT)
63-
givenAttributes(mapOf(SemanticAttributes.HTTP_URL to "https://io.sentry:8081"))
64-
65-
thenRequestIsConsideredInternal()
66-
}
67-
6858
@Test
6959
fun `detects split url as internal (span kind internal)`() {
7060
givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1")
@@ -92,15 +82,6 @@ class OtelInternalSpanDetectionUtilTest {
9282
thenRequestIsConsideredInternal()
9383
}
9484

95-
@Test
96-
fun `detects deprecated url as internal (span kind internal)`() {
97-
givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1")
98-
givenSpanKind(SpanKind.INTERNAL)
99-
givenAttributes(mapOf(SemanticAttributes.HTTP_URL to "https://io.sentry:8081"))
100-
101-
thenRequestIsConsideredInternal()
102-
}
103-
10485
@Test
10586
fun `does not detect full url as internal (span kind server)`() {
10687
givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy