From d5337465d33f83b342d51985c03303dd6c965567 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 1 Jul 2025 14:39:52 +0200 Subject: [PATCH 1/7] Bump OTel SDK to 1.51.0, instrumentation to 2.17.0 and semconv to 1.34.0 --- gradle/libs.versions.toml | 8 ++-- .../OpenTelemetryAttributesExtractor.java | 7 ---- .../OpenTelemetryAttributesExtractorTest.kt | 41 ++++++++++--------- .../OtelInternalSpanDetectionUtilTest.kt | 19 --------- 4 files changed, 26 insertions(+), 49 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1e72c3db711..a47fcc5256e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,11 +19,11 @@ nopen = "1.0.1" # see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility # see https://developer.android.com/jetpack/androidx/releases/compose-kotlin okhttp = "4.9.2" -otel = "1.44.1" -otelInstrumentation = "2.10.0" -otelInstrumentationAlpha = "2.10.0-alpha" +otel = "1.51.0" +otelInstrumentation = "2.17.0" +otelInstrumentationAlpha = "2.17.0-alpha" # 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 -otelSemanticConventions = "1.28.0-alpha" +otelSemanticConventions = "1.34.0-alpha" retrofit = "2.9.0" slf4j = "1.7.30" springboot2 = "2.7.18" diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java index 7d4db373df8..87088ae2377 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java @@ -105,7 +105,6 @@ private static Map collectHeaders( return headers; } - @SuppressWarnings("deprecation") public @Nullable String extractUrl( final @NotNull Attributes attributes, final @NotNull SentryOptions options) { final @Nullable String urlFull = attributes.get(UrlAttributes.URL_FULL); @@ -113,12 +112,6 @@ private static Map collectHeaders( return urlFull; } - final @Nullable String deprecatedUrl = - attributes.get(io.opentelemetry.semconv.SemanticAttributes.HTTP_URL); - if (deprecatedUrl != null) { - return deprecatedUrl; - } - final String urlString = buildUrlString(attributes, options); if (!urlString.isEmpty()) { return urlString; diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt index 42f6f515069..5cc37d80f9c 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt @@ -2,14 +2,15 @@ package io.sentry.opentelemetry import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.sdk.internal.AttributesMap +import io.opentelemetry.sdk.trace.SpanLimits import io.opentelemetry.sdk.trace.data.SpanData import io.opentelemetry.semconv.HttpAttributes -import io.opentelemetry.semconv.SemanticAttributes import io.opentelemetry.semconv.ServerAttributes import io.opentelemetry.semconv.UrlAttributes import io.sentry.Scope import io.sentry.SentryOptions import io.sentry.protocol.Request +import java.util.UUID import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -21,7 +22,7 @@ import org.mockito.kotlin.whenever class OpenTelemetryAttributesExtractorTest { private class Fixture { val spanData = mock() - val attributes = AttributesMap.create(100, 100) + val attributes = AttributesMap.create(100, SpanLimits.getDefault().maxAttributeValueLength) val options = SentryOptions.empty() val scope = Scope(options) @@ -195,15 +196,6 @@ class OpenTelemetryAttributesExtractorTest { assertEquals("https://sentry.io/some/path", url) } - @Test - fun `returns deprecated URL if present`() { - givenAttributes(mapOf(SemanticAttributes.HTTP_URL to "https://sentry.io/some/path")) - - val url = whenExtractingUrl() - - assertEquals("https://sentry.io/some/path", url) - } - @Test fun `returns reconstructed URL if attributes present`() { givenAttributes( @@ -293,19 +285,30 @@ class OpenTelemetryAttributesExtractorTest { @Test fun `sets server request headers based on OTel attributes and merges list of values`() { - givenAttributes( + val elements = + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + val listOf = listOf(elements, "another-baggage=abc,more=def") + val pairs = AttributeKey.stringArrayKey("http.request.header.baggage") to listOf + val map = mapOf( HttpAttributes.HTTP_REQUEST_METHOD to "GET", - AttributeKey.stringArrayKey("http.request.header.baggage") to - listOf( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", - "another-baggage=abc,more=def", - ), + pairs, AttributeKey.stringArrayKey("http.request.header.sentry-trace") to listOf("f9118105af4a2d42b4124532cd176588-4542d085bb0b4de5"), - AttributeKey.stringArrayKey("http.response.header.some-header") to listOf("some-value"), + AttributeKey.stringArrayKey("http.response.header.some-header") to + listOf( + "some-value" + + "__" + + UUID.randomUUID().toString() + + "__" + + UUID.randomUUID().toString() + + "__" + + UUID.randomUUID().toString() + + "__" + + UUID.randomUUID().toString() + ), ) - ) + givenAttributes(map) whenExtractingAttributes() diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt index a67eeb33e81..bc453be6c1a 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt @@ -4,7 +4,6 @@ import io.opentelemetry.api.common.AttributeKey import io.opentelemetry.api.trace.SpanKind import io.opentelemetry.sdk.internal.AttributesMap import io.opentelemetry.semconv.HttpAttributes -import io.opentelemetry.semconv.SemanticAttributes import io.opentelemetry.semconv.ServerAttributes import io.opentelemetry.semconv.UrlAttributes import io.sentry.IScopes @@ -56,15 +55,6 @@ class OtelInternalSpanDetectionUtilTest { thenRequestIsConsideredInternal() } - @Test - fun `detects deprecated url as internal (span kind client)`() { - givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1") - givenSpanKind(SpanKind.CLIENT) - givenAttributes(mapOf(SemanticAttributes.HTTP_URL to "https://io.sentry:8081")) - - thenRequestIsConsideredInternal() - } - @Test fun `detects split url as internal (span kind internal)`() { givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1") @@ -92,15 +82,6 @@ class OtelInternalSpanDetectionUtilTest { thenRequestIsConsideredInternal() } - @Test - fun `detects deprecated url as internal (span kind internal)`() { - givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1") - givenSpanKind(SpanKind.INTERNAL) - givenAttributes(mapOf(SemanticAttributes.HTTP_URL to "https://io.sentry:8081")) - - thenRequestIsConsideredInternal() - } - @Test fun `does not detect full url as internal (span kind server)`() { givenDsn("https://publicKey:secretKey@io.sentry:8081/path/id?sample.rate=0.1") From 3166922e3be10a424771568ecc67033ef17742da Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 3 Jul 2025 11:23:01 +0200 Subject: [PATCH 2/7] Restore span names for GraphQL on the new version of OpenTelemetry (by changing OpenTelemetry defaults) (#4537) * do not override span name if customized * Format code * log in case system property cannot be set * merge * changelog --------- Co-authored-by: Sentry Github Bot --- CHANGELOG.md | 9 +++++++++ ...tryAutoConfigurationCustomizerProvider.java | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d56be095db6..c768770511c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ - Fix javadoc on TransportResult ([#4528](https://github.com/getsentry/sentry-java/pull/4528)) +### Dependencies + +- Bump OpenTelemetry ([#4532](https://github.com/getsentry/sentry-java/pull/4532)) + - `opentelemetry-sdk` to `1.51.0` + - `opentelemetry-instrumentation` to `2.17.0` + - `opentelemetry-javaagent` to `2.17.0` + - `opentelemetry-semconv` to `1.34.0` + - We are now configuring OpenTelemetry to still behave the same way it did before for span names it generates in GraphQL auto instrumentation ([#4537](https://github.com/getsentry/sentry-java/pull/4537)) + ## 8.16.0 ### Features diff --git a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java index e1902f1bed7..59801643678 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java +++ b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java @@ -14,17 +14,23 @@ import io.sentry.protocol.SentryPackage; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public final class SentryAutoConfigurationCustomizerProvider implements AutoConfigurationCustomizerProvider { + private static final Logger logger = + Logger.getLogger(SentryAutoConfigurationCustomizerProvider.class.getName()); + public static volatile boolean skipInit = false; @Override public void customize(AutoConfigurationCustomizer autoConfiguration) { ensureSentryOtelStorageIsInitialized(); + customizeOpenTelemetryDefaults(); final @Nullable ManifestVersionReader.VersionInfoHolder versionInfoHolder = ManifestVersionReader.getInstance().readOpenTelemetryVersion(); @@ -63,6 +69,18 @@ private static void ensureSentryOtelStorageIsInitialized() { Sentry.getGlobalScope(); } + private void customizeOpenTelemetryDefaults() { + try { + if (System.getProperty("otel.instrumentation.graphql.add-operation-name-to-span-name.enabled") + == null) { + System.setProperty( + "otel.instrumentation.graphql.add-operation-name-to-span-name.enabled", "true"); + } + } catch (Exception e) { + logger.log(Level.WARNING, "Unable to change OpenTelemetry defaults for use with Sentry.", e); + } + } + private boolean isSentryAutoInitEnabled() { if (skipInit) { return false; From 12959a78343842bffa3557c1cc884622368236c5 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 4 Jul 2025 11:33:13 +0200 Subject: [PATCH 3/7] more assertions for e2e tests --- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../systemtest/GraphqlProjectSystemTest.kt | 6 +-- .../systemtest/GraphqlTaskSystemTest.kt | 2 +- .../io/sentry/systemtest/PersonSystemTest.kt | 53 ++++++++++++++++++- .../io/sentry/systemtest/TodoSystemTest.kt | 6 +-- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../systemtest/GraphqlProjectSystemTest.kt | 6 +-- .../systemtest/GraphqlTaskSystemTest.kt | 2 +- .../io/sentry/systemtest/PersonSystemTest.kt | 53 ++++++++++++++++++- .../io/sentry/systemtest/TodoSystemTest.kt | 4 +- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../systemtest/GraphqlProjectSystemTest.kt | 6 +-- .../systemtest/GraphqlTaskSystemTest.kt | 6 +-- .../io/sentry/systemtest/PersonSystemTest.kt | 2 +- .../io/sentry/systemtest/TodoSystemTest.kt | 6 +-- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../systemtest/GraphqlProjectSystemTest.kt | 6 +-- .../systemtest/GraphqlTaskSystemTest.kt | 2 +- .../io/sentry/systemtest/PersonSystemTest.kt | 53 ++++++++++++++++++- .../io/sentry/systemtest/TodoSystemTest.kt | 4 +- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../systemtest/GraphqlProjectSystemTest.kt | 4 +- .../systemtest/GraphqlTaskSystemTest.kt | 2 +- .../io/sentry/systemtest/PersonSystemTest.kt | 9 ++-- .../io/sentry/systemtest/TodoSystemTest.kt | 4 +- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../io/sentry/systemtest/TodoSystemTest.kt | 2 +- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../io/sentry/systemtest/TodoSystemTest.kt | 2 +- .../systemtest/GraphqlGreetingSystemTest.kt | 4 +- .../systemtest/GraphqlProjectSystemTest.kt | 6 +-- .../systemtest/GraphqlTaskSystemTest.kt | 6 +-- .../io/sentry/systemtest/PersonSystemTest.kt | 2 +- .../io/sentry/systemtest/TodoSystemTest.kt | 4 +- .../io/sentry/systemtest/util/TestHelper.kt | 11 ++++ 35 files changed, 234 insertions(+), 67 deletions(-) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 32ca579ebf0..f029d3add0c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 86dc807e076..591e5fc49cb 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") } } @@ -34,7 +34,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } @@ -48,7 +48,7 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 84ba14e1bcc..7c4885f6070 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,7 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.tasks") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index b2453181338..55c7dd6ca69 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -46,7 +46,58 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + } + } + + @Test + fun `create person creates transaction if no sampled flag in sentry-trace header`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPerson( + person, + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + } + } + + @Test + fun `create person creates transaction if sampled true in sentry-trace header`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPerson( + person, + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index e2e4325f357..efcecc690ca 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,7 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -34,7 +34,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -47,7 +47,7 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoRestClientSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoRestClientSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index d9a7c8764ec..7015ea2b6f2 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 1dd56b9947e..e1d9bc50492 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query ProjectQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query ProjectQuery", "query ProjectQuery") } } @@ -34,7 +34,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") } } @@ -48,7 +48,7 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 0c37ed28aff..5fd906266c0 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,7 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query TasksAndAssigneesQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query TasksAndAssigneesQuery", "query TasksAndAssigneesQuery") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index b2453181338..55c7dd6ca69 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -46,7 +46,58 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + } + } + + @Test + fun `create person creates transaction if no sampled flag in sentry-trace header`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPerson( + person, + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + } + } + + @Test + fun `create person creates transaction if sampled true in sentry-trace header`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPerson( + person, + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index e2e4325f357..64f10a2bed6 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,7 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -34,7 +34,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 32ca579ebf0..f029d3add0c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 86dc807e076..591e5fc49cb 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") } } @@ -34,7 +34,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } @@ -48,7 +48,7 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index e4e7a6939e8..7a70df46a99 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,9 +30,9 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.tasks") && - testHelper.doesTransactionContainSpanWithDescription(transaction, "Task.assignee") && - testHelper.doesTransactionContainSpanWithDescription(transaction, "Task.creator") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.assignee") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.creator") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 673bee85061..a5d167b2338 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -45,7 +45,7 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "PersonService.create") && - testHelper.doesTransactionContainSpanWithOp(transaction, "db.query") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db.query", "insert into person (firstName, lastName) values (?, ?)") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 3247eefe806..21c092d18b4 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -32,7 +32,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -43,7 +43,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 32ca579ebf0..f029d3add0c 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 86dc807e076..591e5fc49cb 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") } } @@ -34,7 +34,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } @@ -48,7 +48,7 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 84ba14e1bcc..7c4885f6070 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,7 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.tasks") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index b2453181338..55c7dd6ca69 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -46,7 +46,58 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + } + } + + @Test + fun `create person creates transaction if no sampled flag in sentry-trace header`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPerson( + person, + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + } + } + + @Test + fun `create person creates transaction if sampled true in sentry-trace header`() { + val restClient = testHelper.restClient + val person = Person("firstA", "lastB") + val returnedPerson = + restClient.createPerson( + person, + mapOf( + "sentry-trace" to "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1", + "baggage" to + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=f9118105af4a2d42b4124532cd1065ff,sentry-transaction=HTTP%20GET", + ), + ) + assertEquals(200, restClient.lastKnownStatusCode) + + assertEquals(person.firstName, returnedPerson!!.firstName) + assertEquals(person.lastName, returnedPerson!!.lastName) + + testHelper.ensureTransactionReceived { transaction, envelopeHeader -> + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 072fc7ae467..9a8c1967795 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,7 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -34,7 +34,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index d9a7c8764ec..7015ea2b6f2 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 1dd56b9947e..3a7155a2d32 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -34,7 +34,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") } } @@ -48,7 +48,7 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 0c37ed28aff..5fd906266c0 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,7 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "query TasksAndAssigneesQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query TasksAndAssigneesQuery", "query TasksAndAssigneesQuery") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 978703505c0..55c7dd6ca69 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -46,7 +46,8 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") } } @@ -70,7 +71,8 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") } } @@ -94,7 +96,8 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") + testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 072fc7ae467..9a8c1967795 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,7 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -34,7 +34,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 32ca579ebf0..f029d3add0c 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index ca75ce56fa3..29e0692ed3d 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 32ca579ebf0..f029d3add0c 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index ca75ce56fa3..29e0692ed3d 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 32ca579ebf0..f029d3add0c 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,7 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } @@ -32,7 +32,7 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 86dc807e076..591e5fc49cb 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") } } @@ -34,7 +34,7 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } @@ -48,7 +48,7 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index e4e7a6939e8..7a70df46a99 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,9 +30,9 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithDescription(transaction, "Query.tasks") && - testHelper.doesTransactionContainSpanWithDescription(transaction, "Task.assignee") && - testHelper.doesTransactionContainSpanWithDescription(transaction, "Task.creator") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.assignee") && + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.creator") } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 673bee85061..a5d167b2338 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -45,7 +45,7 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "PersonService.create") && - testHelper.doesTransactionContainSpanWithOp(transaction, "db.query") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db.query", "insert into person (firstName, lastName) values (?, ?)") } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 683e6a28c01..7615a5c7fc7 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } @@ -32,7 +32,7 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOp(transaction, "http.client") + testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") } } } diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt index c7011b49e6a..2ecfd40f01b 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt @@ -217,6 +217,17 @@ class TestHelper(backendUrl: String) { return true } + fun doesTransactionContainSpanWithOpAndDescription(transaction: SentryTransaction, op: String, description: String): Boolean { + val span = transaction.spans.firstOrNull { span -> span.op == op && span.description == description } + if (span == null) { + println("Unable to find span with op $op and description $description in transaction:") + logObject(transaction) + return false + } + + return true + } + fun doesTransactionContainSpanWithDescription( transaction: SentryTransaction, description: String, From 81aa960a1c5196d15bee60432659284e10c25c07 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 4 Jul 2025 11:36:37 +0200 Subject: [PATCH 4/7] Use non alpha version for semconv --- gradle/libs.versions.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a47fcc5256e..7ff788acf69 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,7 +23,8 @@ otel = "1.51.0" otelInstrumentation = "2.17.0" otelInstrumentationAlpha = "2.17.0-alpha" # 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 -otelSemanticConventions = "1.34.0-alpha" +otelSemanticConventions = "1.34.0" +otelSemanticConventionsAlpha = "1.34.0-alpha" retrofit = "2.9.0" slf4j = "1.7.30" springboot2 = "2.7.18" @@ -110,7 +111,7 @@ otel-javaagent = { module = "io.opentelemetry.javaagent:opentelemetry-javaagent" otel-javaagent-tooling = { module = "io.opentelemetry.javaagent:opentelemetry-javaagent-tooling", version.ref = "otelInstrumentationAlpha" } otel-javaagent-extension-api = { module = "io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api", version.ref = "otelInstrumentationAlpha" } otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", version.ref = "otelSemanticConventions" } -otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventions" } +otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" } p6spy = { module = "p6spy:p6spy", version = "3.9.1" } quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" } reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" } From c413fb1b2fbe2551af6a058f0338340128c111e8 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 7 Jul 2025 13:58:14 +0200 Subject: [PATCH 5/7] fix changelog --- CHANGELOG.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9e7c94c788..7ee1734f3c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,15 +29,6 @@ - Session Replay: Fix `IllegalArgumentException` when `Bitmap` is initialized with non-positive values ([#4536](https://github.com/getsentry/sentry-java/pull/4536)) - Set thread information on transaction from OpenTelemetry attributes ([#4478](https://github.com/getsentry/sentry-java/pull/4478)) -### Dependencies - -- Bump OpenTelemetry ([#4532](https://github.com/getsentry/sentry-java/pull/4532)) - - `opentelemetry-sdk` to `1.51.0` - - `opentelemetry-instrumentation` to `2.17.0` - - `opentelemetry-javaagent` to `2.17.0` - - `opentelemetry-semconv` to `1.34.0` - - We are now configuring OpenTelemetry to still behave the same way it did before for span names it generates in GraphQL auto instrumentation ([#4537](https://github.com/getsentry/sentry-java/pull/4537)) - ### Internal - Flattened PerformanceCollectionData ([#4505](https://github.com/getsentry/sentry-java/pull/4505)) From 20f02319d633ec9c861abc98f56b1ac1bb84178a Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Mon, 7 Jul 2025 12:00:31 +0000 Subject: [PATCH 6/7] Format code --- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlProjectSystemTest.kt | 18 +++++++++++++++--- .../sentry/systemtest/GraphqlTaskSystemTest.kt | 6 +++++- .../io/sentry/systemtest/PersonSystemTest.kt | 18 +++++++++++++++--- .../io/sentry/systemtest/TodoSystemTest.kt | 18 +++++++++++++++--- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlProjectSystemTest.kt | 18 +++++++++++++++--- .../sentry/systemtest/GraphqlTaskSystemTest.kt | 6 +++++- .../io/sentry/systemtest/PersonSystemTest.kt | 18 +++++++++++++++--- .../io/sentry/systemtest/TodoSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlProjectSystemTest.kt | 18 +++++++++++++++--- .../sentry/systemtest/GraphqlTaskSystemTest.kt | 18 +++++++++++++++--- .../io/sentry/systemtest/PersonSystemTest.kt | 6 +++++- .../io/sentry/systemtest/TodoSystemTest.kt | 18 +++++++++++++++--- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlProjectSystemTest.kt | 18 +++++++++++++++--- .../sentry/systemtest/GraphqlTaskSystemTest.kt | 6 +++++- .../io/sentry/systemtest/PersonSystemTest.kt | 18 +++++++++++++++--- .../io/sentry/systemtest/TodoSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlProjectSystemTest.kt | 12 ++++++++++-- .../sentry/systemtest/GraphqlTaskSystemTest.kt | 6 +++++- .../io/sentry/systemtest/PersonSystemTest.kt | 18 +++++++++++++++--- .../io/sentry/systemtest/TodoSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../io/sentry/systemtest/TodoSystemTest.kt | 6 +++++- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../io/sentry/systemtest/TodoSystemTest.kt | 6 +++++- .../systemtest/GraphqlGreetingSystemTest.kt | 12 ++++++++++-- .../systemtest/GraphqlProjectSystemTest.kt | 18 +++++++++++++++--- .../sentry/systemtest/GraphqlTaskSystemTest.kt | 18 +++++++++++++++--- .../io/sentry/systemtest/PersonSystemTest.kt | 6 +++++- .../io/sentry/systemtest/TodoSystemTest.kt | 12 ++++++++++-- .../io/sentry/systemtest/util/TestHelper.kt | 9 +++++++-- 35 files changed, 372 insertions(+), 75 deletions(-) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index f029d3add0c..76a6024decc 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 591e5fc49cb..fca3956717c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.project", + ) } } @@ -34,7 +38,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } @@ -48,7 +56,11 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 7c4885f6070..f9359ae1496 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,11 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.tasks", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 55c7dd6ca69..707b5025dcf 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -47,7 +47,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -72,7 +76,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -97,7 +105,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index efcecc690ca..e92ad0a17f9 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,11 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -34,7 +38,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -47,7 +55,11 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoRestClientSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoRestClientSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 7015ea2b6f2..4286cfa1a86 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query GreetingQuery", + "query GreetingQuery", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query GreetingQuery", + "query GreetingQuery", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index e1d9bc50492..f592b2a08ec 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query ProjectQuery", "query ProjectQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query ProjectQuery", + "query ProjectQuery", + ) } } @@ -34,7 +38,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "mutation AddProjectMutation", + "mutation AddProjectMutation", + ) } } @@ -48,7 +56,11 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "mutation AddProjectMutation", + "mutation AddProjectMutation", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 5fd906266c0..f811da5a082 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,11 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query TasksAndAssigneesQuery", "query TasksAndAssigneesQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query TasksAndAssigneesQuery", + "query TasksAndAssigneesQuery", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 55c7dd6ca69..707b5025dcf 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -47,7 +47,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -72,7 +76,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -97,7 +105,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 64f10a2bed6..18dc7d3f552 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,11 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -34,7 +38,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index f029d3add0c..76a6024decc 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 591e5fc49cb..fca3956717c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.project", + ) } } @@ -34,7 +38,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } @@ -48,7 +56,11 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 7a70df46a99..940709c0778 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,9 +30,21 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.assignee") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.creator") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.tasks", + ) && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Task.assignee", + ) && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Task.creator", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a5d167b2338..7d6e0182530 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -45,7 +45,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "PersonService.create") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db.query", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db.query", + "insert into person (firstName, lastName) values (?, ?)", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 21c092d18b4..d34485e1388 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -32,7 +36,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -43,7 +51,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index f029d3add0c..76a6024decc 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 591e5fc49cb..fca3956717c 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.project", + ) } } @@ -34,7 +38,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } @@ -48,7 +56,11 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 7c4885f6070..f9359ae1496 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,11 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.tasks", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 55c7dd6ca69..707b5025dcf 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -47,7 +47,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -72,7 +76,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -97,7 +105,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 9a8c1967795..d1659b2089d 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,11 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -34,7 +38,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index 7015ea2b6f2..4286cfa1a86 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query GreetingQuery", + "query GreetingQuery", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query GreetingQuery", "query GreetingQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query GreetingQuery", + "query GreetingQuery", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 3a7155a2d32..f4ce7610274 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -34,7 +34,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "mutation AddProjectMutation", + "mutation AddProjectMutation", + ) } } @@ -48,7 +52,11 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "mutation AddProjectMutation", "mutation AddProjectMutation") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "mutation AddProjectMutation", + "mutation AddProjectMutation", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 5fd906266c0..f811da5a082 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,7 +30,11 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "query TasksAndAssigneesQuery", "query TasksAndAssigneesQuery") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "query TasksAndAssigneesQuery", + "query TasksAndAssigneesQuery", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index 55c7dd6ca69..707b5025dcf 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -47,7 +47,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -72,7 +76,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } @@ -97,7 +105,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "spanCreatedThroughSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db", + "insert into person (firstName, lastName) values (?, ?)", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 9a8c1967795..d1659b2089d 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -23,7 +23,11 @@ class TodoSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanOtelApi") && testHelper.doesTransactionContainSpanWithOp(transaction, "todoSpanSentryApi") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -34,7 +38,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index f029d3add0c..76a6024decc 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 29e0692ed3d..b06b82a62ee 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index f029d3add0c..76a6024decc 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 29e0692ed3d..b06b82a62ee 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt index f029d3add0c..76a6024decc 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlGreetingSystemTest.kt @@ -19,7 +19,11 @@ class GraphqlGreetingSystemTest { testHelper.ensureNoErrors(response) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } @@ -32,7 +36,11 @@ class GraphqlGreetingSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.greeting") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.greeting", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt index 591e5fc49cb..fca3956717c 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlProjectSystemTest.kt @@ -23,7 +23,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertEquals("proj-slug", response?.data?.project?.slug) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.project") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.project", + ) } } @@ -34,7 +38,11 @@ class GraphqlProjectSystemTest { testHelper.ensureNoErrors(response) assertNotNull(response?.data?.addProject) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } @@ -48,7 +56,11 @@ class GraphqlProjectSystemTest { error.message?.message?.startsWith("Unresolved RuntimeException for executionId ") ?: false } testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Mutation.addProject") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Mutation.addProject", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt index 7a70df46a99..940709c0778 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/GraphqlTaskSystemTest.kt @@ -30,9 +30,21 @@ class GraphqlTaskSystemTest { assertEquals("C3", firstTask.creator?.id) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Query.tasks") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.assignee") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "graphql", "Task.creator") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Query.tasks", + ) && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Task.assignee", + ) && + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "graphql", + "Task.creator", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt index a5d167b2338..7d6e0182530 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt @@ -45,7 +45,11 @@ class PersonSystemTest { testHelper.ensureTransactionReceived { transaction, envelopeHeader -> testHelper.doesTransactionContainSpanWithOp(transaction, "PersonService.create") && - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "db.query", "insert into person (firstName, lastName) values (?, ?)") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "db.query", + "insert into person (firstName, lastName) values (?, ?)", + ) } } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt index 7615a5c7fc7..965e6953b06 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt +++ b/sentry-samples/sentry-samples-spring-boot/src/test/kotlin/io/sentry/systemtest/TodoSystemTest.kt @@ -21,7 +21,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } @@ -32,7 +36,11 @@ class TodoSystemTest { assertEquals(200, restClient.lastKnownStatusCode) testHelper.ensureTransactionReceived { transaction, envelopeHeader -> - testHelper.doesTransactionContainSpanWithOpAndDescription(transaction, "http.client", "GET https://jsonplaceholder.typicode.com/todos/1") + testHelper.doesTransactionContainSpanWithOpAndDescription( + transaction, + "http.client", + "GET https://jsonplaceholder.typicode.com/todos/1", + ) } } } diff --git a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt index 2ecfd40f01b..db797646146 100644 --- a/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt +++ b/sentry-system-test-support/src/main/kotlin/io/sentry/systemtest/util/TestHelper.kt @@ -217,8 +217,13 @@ class TestHelper(backendUrl: String) { return true } - fun doesTransactionContainSpanWithOpAndDescription(transaction: SentryTransaction, op: String, description: String): Boolean { - val span = transaction.spans.firstOrNull { span -> span.op == op && span.description == description } + fun doesTransactionContainSpanWithOpAndDescription( + transaction: SentryTransaction, + op: String, + description: String, + ): Boolean { + val span = + transaction.spans.firstOrNull { span -> span.op == op && span.description == description } if (span == null) { println("Unable to find span with op $op and description $description in transaction:") logObject(transaction) From 4d67f9cd5772e0089cff8396a48bc986633846ed Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 8 Jul 2025 15:56:31 +0200 Subject: [PATCH 7/7] api file and format --- sentry-system-test-support/api/sentry-system-test-support.api | 1 + 1 file changed, 1 insertion(+) diff --git a/sentry-system-test-support/api/sentry-system-test-support.api b/sentry-system-test-support/api/sentry-system-test-support.api index 34d1fbdfff2..4f5bb9634a0 100644 --- a/sentry-system-test-support/api/sentry-system-test-support.api +++ b/sentry-system-test-support/api/sentry-system-test-support.api @@ -554,6 +554,7 @@ public final class io/sentry/systemtest/util/TestHelper { public final fun doesContainLogWithBody (Lio/sentry/SentryLogEvents;Ljava/lang/String;)Z public final fun doesTransactionContainSpanWithDescription (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z public final fun doesTransactionContainSpanWithOp (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z + public final fun doesTransactionContainSpanWithOpAndDescription (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;Ljava/lang/String;)Z public final fun doesTransactionHaveOp (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z public final fun doesTransactionHaveTraceId (Lio/sentry/protocol/SentryTransaction;Ljava/lang/String;)Z public final fun ensureEnvelopeCountIncreased ()V