From dbe96296de6595d6fb7511563f79db1a0d237897 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 9 Nov 2026 14:13:47 +0100 Subject: [PATCH] fix(ktor): Preserve Ktor 3.0 runtime compatibility Avoid inlining Ktor 3.6's AttributeKey factory. The inlined code references a TypeInfo constructor unavailable in older Ktor 3.x runtimes. Construct TypeInfo explicitly through its stable two-argument constructor instead. --- .../java/io/sentry/ktorClient/SentryKtorClientPlugin.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt b/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt index 0e4538fb418..0109aeb9fbc 100644 --- a/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt +++ b/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt @@ -7,6 +7,7 @@ import io.ktor.client.request.* import io.ktor.client.statement.* import io.ktor.util.* import io.ktor.util.pipeline.* +import io.ktor.util.reflect.TypeInfo import io.sentry.BaggageHeader import io.sentry.BuildConfig import io.sentry.DataCategory @@ -98,9 +99,13 @@ public val SentryKtorClientPlugin: ClientPlugin = // Attributes // Request start time for breadcrumbs - val requestStartTimestampKey = AttributeKey("SentryRequestStartTimestamp") + val requestStartTimestampKey = + AttributeKey( + "SentryRequestStartTimestamp", + TypeInfo(SentryDate::class, null), + ) // Span associated with the request - val requestSpanKey = AttributeKey("SentryRequestSpan") + val requestSpanKey = AttributeKey("SentryRequestSpan", TypeInfo(ISpan::class, null)) onRequest { request, _ -> val effectiveScopes = if (forceScopes) scopes else Sentry.getCurrentScopes()