Skip to content

Commit dbe9629

Browse files
committed
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.
1 parent 428b761 commit dbe9629

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import io.ktor.client.request.*
77
import io.ktor.client.statement.*
88
import io.ktor.util.*
99
import io.ktor.util.pipeline.*
10+
import io.ktor.util.reflect.TypeInfo
1011
import io.sentry.BaggageHeader
1112
import io.sentry.BuildConfig
1213
import io.sentry.DataCategory
@@ -98,9 +99,13 @@ public val SentryKtorClientPlugin: ClientPlugin<SentryKtorClientPluginConfig> =
9899

99100
// Attributes
100101
// Request start time for breadcrumbs
101-
val requestStartTimestampKey = AttributeKey<SentryDate>("SentryRequestStartTimestamp")
102+
val requestStartTimestampKey =
103+
AttributeKey<SentryDate>(
104+
"SentryRequestStartTimestamp",
105+
TypeInfo(SentryDate::class, null),
106+
)
102107
// Span associated with the request
103-
val requestSpanKey = AttributeKey<ISpan>("SentryRequestSpan")
108+
val requestSpanKey = AttributeKey<ISpan>("SentryRequestSpan", TypeInfo(ISpan::class, null))
104109

105110
onRequest { request, _ ->
106111
val effectiveScopes = if (forceScopes) scopes else Sentry.getCurrentScopes()

0 commit comments

Comments
 (0)