From 691380095dd19635132933891f4d6de3593e4d58 Mon Sep 17 00:00:00 2001 From: lcian Date: Fri, 25 Jul 2025 11:04:03 +0200 Subject: [PATCH 01/14] feat(android): document Ktor Client integration --- .../integrations/ktor-client/index.mdx | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 docs/platforms/android/integrations/ktor-client/index.mdx diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx new file mode 100644 index 0000000000000..e00d955397061 --- /dev/null +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -0,0 +1,180 @@ +--- +title: Ktor Client +caseStyle: camelCase +supportLevel: production +sdk: sentry.java.ktor-client +description: "Learn more about the Sentry Ktor Client integration for the Android SDK." +categories: + - mobile +--- + +The `sentry-ktor-client` library provides [Ktor Client](https://ktor.io/) support for Sentry via the Sentry Ktor Client Plugin. + +On this page, we get you up and running with Sentry's Ktor Client Integration. +The integration supports: +- Adding breadcrumbs for each HTTP request +- Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any) +- Capturing certain request failures as errors in Sentry. + +The Sentry Ktor Client integration supports Ktor Client version `3.x`. + + + If you're using Ktor Client with OKHttp as the engine, and you're already using the [Sentry OkHttp integration](/platforms/android/integrations/okhttp/), + either with manual or automatic installation (via the Sentry Android Gradle Plugin), you shouldn't use this integration, otherwise the SDK will produce duplicate data, instrumenting each HTTP request twice. + + +## Install + +Add a dependency to the Sentry SDK and to the Sentry Ktor Client Plugin: + +```groovy +implementation 'io.sentry:sentry-android:{{@inject packages.version('sentry.java.android', '8.18.0') }}' +implementation 'io.sentry:sentry-ktor-client:{{@inject packages.version('sentry.java.ktor-client', '8.18.0') }}' +``` + +## Configure + +Create the Ktor HTTP Client with your preferred engine, and install the Sentry Ktor Client Plugin: + + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.android.* +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Android) { + install(SentryKtorClientPlugin) +} +``` + +## Verify + +This snippet includes a HTTP Request and captures an intentional message, so you can test that everything is working as soon as you set it up: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.android.* +import io.ktor.client.request.* +import io.ktor.client.statement.* +import io.sentry.ktorClient.SentryKtorClientPlugin +import io.sentry.Sentry + +suspend fun run(url: String): String? { + val ktorClient = HttpClient(Android) { + install(SentryKtorClientPlugin) + } + + val response = ktorClient.get(url) + val bodyStr = response.bodyAsText() + + Sentry.captureMessage("The Message $bodyStr") + + return bodyStr +} +``` + + + + Learn more about manually capturing an error or message, in our Usage documentation. + + + +To view and resolve the recorded message, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + +## Customize the Recorded Span + +The captured span can be customized or dropped with a `BeforeSpanCallback`: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.android.* +import io.ktor.client.request.* +import io.ktor.http.* +import io.sentry.ISpan +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Android) { + install(SentryKtorClientPlugin) { + beforeSpan = { span, request -> + // Drop spans for admin requests + if (request.url.toString().contains("/admin")) { + null + } else { + span + } + } + } +} +``` + +## HTTP Client Errors + +This feature automatically captures HTTP client errors (like bad response codes) as error events and reports them to Sentry. The error event will contain the `request` and `response` data, including the `url`, `status_code`, and so on. + +HTTP client error capturing is enabled by default. The SDK captures HTTP client errors with a response code between `500` and `599`, but you can change this behavior by configuring the plugin: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.android.* +import io.sentry.HttpStatusCodeRange +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Android) { + install(SentryKtorClientPlugin) { + captureFailedRequests = true + failedRequestStatusCodes = listOf(HttpStatusCodeRange(400, 599)) + } +} +``` + +HTTP client errors from every target (`.*` regular expression) are automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. A plain string must contain at least one of the items from the list. Plain strings don't have to be full matches, meaning the URL of a request is matched when it contains a string provided through the option. + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.android.* +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Android) { + install(SentryKtorClientPlugin) { + captureFailedRequests = true + failedRequestTargets = listOf("myapi.com") + } +} +``` + +By default, error events won't contain any PII data, such as `Headers` and `Cookies`, but you can change this behavior by setting the `sendDefaultPii` option to `true`: + +```xml {filename:AndroidManifest.xml} + + + +``` + +Those events are searchable and you can set alerts on them if you use the `http.url` and `http.status_code` properties. Learn more in our full [Searchable Properties](/concepts/search/searchable-properties/) documentation. + +### Customize or Drop the Error Event + +To customize or drop the error event, you need to do a [manual initialization](/platforms/android/configuration/manual-init/#manual-initialization) of the Sentry Android SDK. + +The captured error event can be customized or dropped with a `BeforeSendCallback`: + +```kotlin +import io.sentry.android.core.SentryAndroid +import io.sentry.SentryOptions.BeforeSendCallback +import io.sentry.TypeCheckHint.KTOR_REQUEST +import io.sentry.TypeCheckHint.KTOR_RESPONSE +import io.ktor.client.request.* +import io.ktor.client.statement.* + +SentryAndroid.init(this) { options -> + // Add a callback that will be used before the event is sent to Sentry. + // With this callback, you can modify the event or, when returning null, also discard the event. + options.beforeSend = BeforeSendCallback { event, hint -> + val request = hint.getAs(KTOR_REQUEST, HttpRequest::class.java) + val response = hint.getAs(KTOR_RESPONSE, HttpResponse::class.java) + + // customize or drop the event + event + } +} +``` From 627bbee40e8e97a314989c6f3e5184b4d41e49cd Mon Sep 17 00:00:00 2001 From: lcian Date: Fri, 25 Jul 2025 11:08:55 +0200 Subject: [PATCH 02/14] improve --- docs/platforms/android/integrations/ktor-client/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index e00d955397061..f45ddcf734211 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -161,8 +161,8 @@ The captured error event can be customized or dropped with a `BeforeSendCallback ```kotlin import io.sentry.android.core.SentryAndroid import io.sentry.SentryOptions.BeforeSendCallback -import io.sentry.TypeCheckHint.KTOR_REQUEST -import io.sentry.TypeCheckHint.KTOR_RESPONSE +import io.sentry.TypeCheckHint.KTOR_CLIENT_REQUEST +import io.sentry.TypeCheckHint.KTOR_CLIENT_RESPONSE import io.ktor.client.request.* import io.ktor.client.statement.* @@ -170,8 +170,8 @@ SentryAndroid.init(this) { options -> // Add a callback that will be used before the event is sent to Sentry. // With this callback, you can modify the event or, when returning null, also discard the event. options.beforeSend = BeforeSendCallback { event, hint -> - val request = hint.getAs(KTOR_REQUEST, HttpRequest::class.java) - val response = hint.getAs(KTOR_RESPONSE, HttpResponse::class.java) + val request = hint.getAs(KTOR_CLIENT_REQUEST, HttpRequest::class.java) + val response = hint.getAs(KTOR_CLIENT_RESPONSE, HttpResponse::class.java) // customize or drop the event event From 52cb5b3ac798f225d4a3b031f26bba523bbc9f46 Mon Sep 17 00:00:00 2001 From: lcian Date: Fri, 25 Jul 2025 11:47:30 +0200 Subject: [PATCH 03/14] feat(java): document Ktor Client integration --- .../tracing/instrumentation/ktor-client.mdx | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx diff --git a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx new file mode 100644 index 0000000000000..1259fff1b9717 --- /dev/null +++ b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx @@ -0,0 +1,177 @@ +--- +title: Ktor Client Integration +sidebar_order: 45 +sdk: sentry.java.ktor-client +description: "Learn how to capture tracing information of the Ktor Client." +notSupported: + - java.logback + - java.log4j2 + - java.jul +--- + + + +To be able to capture transactions, you'll need to first set up tracing. + + + +The `sentry-ktor-client` library provides [Ktor Client](https://ktor.io/) support for Sentry via the Sentry Ktor Client Plugin. The source can be found [on GitHub](https://github.com/getsentry/sentry-java/tree/main/sentry-ktor-client). + +On this page, we get you up and running with Sentry's Ktor Client Integration. +The integration supports: +- Adding breadcrumbs for each HTTP request +- Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any) +- Capturing certain request failures as errors in Sentry. + +The Sentry Ktor Client integration supports Ktor Client version `3.x`. + + + If you're using Ktor Client with OKHttp as the engine, and you're already using the [Sentry OkHttp integration](/platforms/java/tracing/instrumentation/okhttp/), + you shouldn't use this integration, otherwise the SDK will produce duplicate data, instrumenting each HTTP request twice. + + +## Install + +To install the integration: + +```groovy {tabTitle:Gradle} +implementation 'io.sentry:sentry-ktor-client:{{@inject packages.version('sentry.java.ktor-client', '8.18.0') }}' +``` + +## Configure + +Create the Ktor HTTP Client with your preferred engine, and install the Sentry Ktor Client Plugin: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.java.* +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Java) { + install(SentryKtorClientPlugin) +} +``` + +## Verify + +This snippet includes a HTTP Request and captures an intentional message, so you can test that everything is working as soon as you set it up: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.java.* +import io.ktor.client.request.* +import io.ktor.client.statement.* +import io.sentry.ktorClient.SentryKtorClientPlugin +import io.sentry.Sentry + +suspend fun run(url: String): String? { + val ktorClient = HttpClient(Java) { + install(SentryKtorClientPlugin) + } + + val response = ktorClient.get(url) + val bodyStr = response.bodyAsText() + + Sentry.captureMessage("The Message $bodyStr") + + return bodyStr +} +``` + +To view and resolve the recorded message, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. + +## Customize the Recorded Span + +The captured span can be customized or dropped with a `BeforeSpanCallback`: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.java.* +import io.ktor.client.request.* +import io.ktor.http.* +import io.sentry.ISpan +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Java) { + install(SentryKtorClientPlugin) { + beforeSpan = { span, request -> + // Drop spans for admin requests + if (request.url.toString().contains("/admin")) { + null + } else { + span + } + } + } +} +``` + +## HTTP Client Errors + +This feature automatically captures HTTP client errors (like bad response codes) as error events and reports them to Sentry. The error event will contain the `request` and `response` data, including the `url`, `status_code`, and so on. + +HTTP client error capturing is enabled by default. The SDK captures HTTP client errors with a response code between `500` and `599`, but you can change this behavior by configuring the plugin: + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.java.* +import io.sentry.HttpStatusCodeRange +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Java) { + install(SentryKtorClientPlugin) { + captureFailedRequests = true + failedRequestStatusCodes = listOf(HttpStatusCodeRange(400, 599)) + } +} +``` + +HTTP client errors from every target (`.*` regular expression) are automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. A plain string must contain at least one of the items from the list. Plain strings don't have to be full matches, meaning the URL of a request is matched when it contains a string provided through the option. + +```kotlin +import io.ktor.client.* +import io.ktor.client.engine.java.* +import io.sentry.ktorClient.SentryKtorClientPlugin + +val ktorClient = HttpClient(Java) { + install(SentryKtorClientPlugin) { + captureFailedRequests = true + failedRequestTargets = listOf("myapi.com") + } +} +``` + +By default, error events won't contain any PII data, such as `Headers` and `Cookies`, but you can change this behavior by setting the `sendDefaultPii` option to `true`: + +```kotlin +Sentry.init { options -> + options.isSendDefaultPii = true +} +``` + +Those events are searchable and you can set alerts on them if you use the `http.url` and `http.status_code` properties. Learn more in our full [Searchable Properties](/concepts/search/searchable-properties/) documentation. + +### Customize or Drop the Error Event + +The captured error event can be customized or dropped with a `BeforeSendCallback`: + +```kotlin +import io.sentry.Sentry +import io.sentry.SentryOptions.BeforeSendCallback +import io.sentry.TypeCheckHint.KTOR_CLIENT_REQUEST +import io.sentry.TypeCheckHint.KTOR_CLIENT_RESPONSE +import io.ktor.client.request.* +import io.ktor.client.statement.* + +Sentry.init { options -> + // Add a callback that will be used before the event is sent to Sentry. + // With this callback, you can modify the event or, when returning null, also discard the event. + options.beforeSend = BeforeSendCallback { event, hint -> + val request = hint.getAs(KTOR_CLIENT_REQUEST, HttpRequest::class.java) + val response = hint.getAs(KTOR_CLIENT_RESPONSE, HttpResponse::class.java) + + // customize or drop the event + event + } +} +``` \ No newline at end of file From 23d24b79e2d3541473d38de4bf981f7fd3d046fd Mon Sep 17 00:00:00 2001 From: lcian Date: Fri, 25 Jul 2025 12:08:55 +0200 Subject: [PATCH 04/14] improve --- .../java/common/tracing/instrumentation/ktor-client.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx index 1259fff1b9717..4882a7ae120d5 100644 --- a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx +++ b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx @@ -2,7 +2,7 @@ title: Ktor Client Integration sidebar_order: 45 sdk: sentry.java.ktor-client -description: "Learn how to capture tracing information of the Ktor Client." +description: "Learn how to capture tracing information when using Ktor Client." notSupported: - java.logback - java.log4j2 @@ -174,4 +174,4 @@ Sentry.init { options -> event } } -``` \ No newline at end of file +``` From cd1feb62fae9f031b25e7cf6ab5ec205389ec16b Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:58:06 +0200 Subject: [PATCH 05/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- docs/platforms/android/integrations/ktor-client/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index f45ddcf734211..cf864b0d4642f 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -13,7 +13,7 @@ The `sentry-ktor-client` library provides [Ktor Client](https://ktor.io/) suppor On this page, we get you up and running with Sentry's Ktor Client Integration. The integration supports: - Adding breadcrumbs for each HTTP request -- Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any) +- Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any). - Capturing certain request failures as errors in Sentry. The Sentry Ktor Client integration supports Ktor Client version `3.x`. From 9ee3da27d6eb84458aad606e54d5527bc36ebab6 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:58:41 +0200 Subject: [PATCH 06/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- docs/platforms/android/integrations/ktor-client/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index cf864b0d4642f..16d1af4493bfc 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -12,7 +12,7 @@ The `sentry-ktor-client` library provides [Ktor Client](https://ktor.io/) suppor On this page, we get you up and running with Sentry's Ktor Client Integration. The integration supports: -- Adding breadcrumbs for each HTTP request +- Adding breadcrumbs for each HTTP request. - Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any). - Capturing certain request failures as errors in Sentry. From 2d22a055fc77fa7a4dad09edee5097bd47f5edf1 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:58:53 +0200 Subject: [PATCH 07/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- docs/platforms/android/integrations/ktor-client/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index 16d1af4493bfc..4a7929019da17 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -49,7 +49,7 @@ val ktorClient = HttpClient(Android) { ## Verify -This snippet includes a HTTP Request and captures an intentional message, so you can test that everything is working as soon as you set it up: +This snippet includes an HTTP Request and captures an intentional message, so you can verify that everything is working as soon as you set it up: ```kotlin import io.ktor.client.* From ed3d6574db48a19bf5906675752d459c1b6edfa7 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:59:04 +0200 Subject: [PATCH 08/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- docs/platforms/android/integrations/ktor-client/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index 4a7929019da17..3391e5a0af021 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -75,7 +75,7 @@ suspend fun run(url: String): String? { - Learn more about manually capturing an error or message, in our Usage documentation. + Learn more about manually capturing an error or message in our Usage documentation. From a37214f7119ed5079776e096c36198d8b82df182 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:59:15 +0200 Subject: [PATCH 09/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- docs/platforms/android/integrations/ktor-client/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index 3391e5a0af021..0e672e1ff1971 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -111,7 +111,7 @@ val ktorClient = HttpClient(Android) { This feature automatically captures HTTP client errors (like bad response codes) as error events and reports them to Sentry. The error event will contain the `request` and `response` data, including the `url`, `status_code`, and so on. -HTTP client error capturing is enabled by default. The SDK captures HTTP client errors with a response code between `500` and `599`, but you can change this behavior by configuring the plugin: +HTTP client error capturing is enabled by default. The SDK captures HTTP client errors with a response code between `500` and `599` by default, but you can change this behavior by configuring the plugin: ```kotlin import io.ktor.client.* From 8b606ce7ae9cfac71b60cf12b38aea6a6a6f8d4b Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:59:32 +0200 Subject: [PATCH 10/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- docs/platforms/android/integrations/ktor-client/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index 0e672e1ff1971..2edee8a2593eb 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -127,7 +127,7 @@ val ktorClient = HttpClient(Android) { } ``` -HTTP client errors from every target (`.*` regular expression) are automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. A plain string must contain at least one of the items from the list. Plain strings don't have to be full matches, meaning the URL of a request is matched when it contains a string provided through the option. +HTTP client errors from every target (`.*` regular expression) are automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. A plain string must contain at least one of the items from the list. Plain strings don’t need to match the entire URL — a match occurs as long as the URL contains the string provided in the option. ```kotlin import io.ktor.client.* From c6e922ab2fab6f54d26fbad10834371f690cbb1a Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 10:59:55 +0200 Subject: [PATCH 11/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- .../java/common/tracing/instrumentation/ktor-client.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx index 4882a7ae120d5..fac41c38e327e 100644 --- a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx +++ b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx @@ -19,7 +19,7 @@ The `sentry-ktor-client` library provides [Ktor Client](https://ktor.io/) suppor On this page, we get you up and running with Sentry's Ktor Client Integration. The integration supports: -- Adding breadcrumbs for each HTTP request +- Adding breadcrumbs for each HTTP request. - Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any) - Capturing certain request failures as errors in Sentry. From faf7d71658b13ed3a02b6d93b9d2077ac3b40a02 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 11:00:01 +0200 Subject: [PATCH 12/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- .../java/common/tracing/instrumentation/ktor-client.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx index fac41c38e327e..ad3073495185a 100644 --- a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx +++ b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx @@ -20,7 +20,7 @@ The `sentry-ktor-client` library provides [Ktor Client](https://ktor.io/) suppor On this page, we get you up and running with Sentry's Ktor Client Integration. The integration supports: - Adding breadcrumbs for each HTTP request. -- Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any) +- Capturing spans for each HTTP Request, with support for distributed tracing. The span will be created as a child of the current span bound to the scope (if any). - Capturing certain request failures as errors in Sentry. The Sentry Ktor Client integration supports Ktor Client version `3.x`. From 382e437a80f2e2aaf418a3a137c0227e7fa2009c Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Tue, 29 Jul 2025 11:00:10 +0200 Subject: [PATCH 13/14] Apply suggestion from @coolguyzone Co-authored-by: Alex Krawiec --- .../java/common/tracing/instrumentation/ktor-client.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx index ad3073495185a..46710813c6848 100644 --- a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx +++ b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx @@ -54,7 +54,7 @@ val ktorClient = HttpClient(Java) { ## Verify -This snippet includes a HTTP Request and captures an intentional message, so you can test that everything is working as soon as you set it up: +This snippet includes an HTTP Request and captures an intentional message, so you can verify that everything is working as soon as you set it up: ```kotlin import io.ktor.client.* From 7236fe30829a8b2ded32ab4024aaf824d330a870 Mon Sep 17 00:00:00 2001 From: lcian Date: Tue, 29 Jul 2025 11:05:54 +0200 Subject: [PATCH 14/14] improve --- docs/platforms/android/integrations/ktor-client/index.mdx | 3 ++- .../java/common/tracing/instrumentation/ktor-client.mdx | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/platforms/android/integrations/ktor-client/index.mdx b/docs/platforms/android/integrations/ktor-client/index.mdx index 2edee8a2593eb..5b667569dcff7 100644 --- a/docs/platforms/android/integrations/ktor-client/index.mdx +++ b/docs/platforms/android/integrations/ktor-client/index.mdx @@ -20,7 +20,8 @@ The Sentry Ktor Client integration supports Ktor Client version `3.x`. If you're using Ktor Client with OKHttp as the engine, and you're already using the [Sentry OkHttp integration](/platforms/android/integrations/okhttp/), - either with manual or automatic installation (via the Sentry Android Gradle Plugin), you shouldn't use this integration, otherwise the SDK will produce duplicate data, instrumenting each HTTP request twice. + either with manual or automatic installation (via the Sentry Android Gradle Plugin), you should avoid using this integration, otherwise the SDK will produce duplicate data, instrumenting each HTTP request twice. + Use the [Sentry OkHttp integration](/platforms/android/integrations/okhttp/) instead, as it provides more detailed information about HTTP request. ## Install diff --git a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx index 46710813c6848..fc08b57cac482 100644 --- a/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx +++ b/docs/platforms/java/common/tracing/instrumentation/ktor-client.mdx @@ -15,7 +15,7 @@ To be able to capture transactions, you'll need to first If you're using Ktor Client with OKHttp as the engine, and you're already using the [Sentry OkHttp integration](/platforms/java/tracing/instrumentation/okhttp/), - you shouldn't use this integration, otherwise the SDK will produce duplicate data, instrumenting each HTTP request twice. + you should avoid using this integration, otherwise the SDK will produce duplicate data, instrumenting each HTTP request twice. + Use the [Sentry OkHttp integration](/platforms/java/tracing/instrumentation/okhttp/) instead, as it provides more detailed information about HTTP request. ## Install