Skip to content

Commit ee0ba5d

Browse files
buenaflorlizokm
andauthored
feat(kmp): update getting started and add manual setup page (#11497)
* fix(dart): beforeSend code snippet Current code snippet example doesn't compile in dart * update * update * update * Update * Update index.mdx * Update index.mdx * update docs * update sidebars * fix typo * Apply suggestions from code review Co-authored-by: Liza Mock <liza.mock@sentry.io> * update java link --------- Co-authored-by: Liza Mock <liza.mock@sentry.io>
1 parent 399f529 commit ee0ba5d

File tree

13 files changed

+284
-240
lines changed

13 files changed

+284
-240
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Gradle Plugin
3+
sidebar_order: 5
4+
description: "Learn how to set up Sentry's Kotlin Multiplatform Gradle Plugin."
5+
---
6+
7+
The [Sentry Kotlin Multiplatform Gradle Plugin](https://github.com/getsentry/sentry-kotlin-multiplatform/tree/main/sentry-kotlin-multiplatform-gradle-plugin) is a plugin that simplifies the set up process. It can be used to configure the Sentry SDK for Kotlin Multiplatform projects.
8+
9+
The Gradle Plugin supports the following features:
10+
- Auto-installation of the Sentry Kotlin Multiplatform SDK.
11+
- Auto-installation of the Sentry Cocoa SDK via Cocoapods (if the Kotlin Cocoapods plugin is applied).
12+
- Automatic configuration of the Kotlin/Native linker for seamless usage with the Swift Package Manager.
13+
14+
## Setup
15+
16+
### Install
17+
18+
Using Gradle in your `shared/build.gradle.kts` add:
19+
20+
```kotlin {filename:shared/build.gradle.kts}
21+
plugins {
22+
id("io.sentry.kotlin.multiplatform.gradle") version "{{@inject packages.version('sentry.kotlin.kmp', '0.9.0') }}"
23+
}
24+
```
25+
26+
### Configure
27+
28+
We expose the following configuration values:
29+
30+
```kotlin {filename:shared/build.gradle.kts}
31+
sentryKmp {
32+
// Configure auto-installation of Sentry components.
33+
autoInstall {
34+
// Enable auto-installation of Sentry components:
35+
// - Sentry Kotlin Multiplatform SDK
36+
// - Sentry Cocoa SDK with Cocoapods if Kotlin Cocoapods plugin is applied.
37+
// Default is enabled.
38+
enabled = true
39+
40+
// Configure the commonMain source set.
41+
commonMain {
42+
// Enable auto-installation of the Sentry Kotlin Multiplatform SDK in commonMain.
43+
// Default is enabled.
44+
enabled = true
45+
46+
// Specify the version of the Sentry Kotlin Multiplatform SDK to use.
47+
// Default is the corresponding Kotlin Multiplatform SDK version.
48+
sentryKmpVersion = "{{@inject packages.version('sentry.kotlin.kmp', '0.9.0') }}"
49+
}
50+
51+
// Configure the Cocoapods plugin.
52+
cocoapods {
53+
// Enable auto-installation of the Sentry Cocoa SDK with Cocoapods.
54+
// Default is enabled.
55+
enabled = true
56+
57+
// Specify the version of the Sentry Cocoa SDK to install.
58+
// Default is the Cocoa SDK version used in the Kotlin Multiplatform SDK.
59+
sentryCocoaVersion = "8.38.0"
60+
}
61+
62+
// Configure the linker. This is only relevant if you are using SPM.
63+
linker {
64+
// Enable auto-configuration of the Kotlin/Native linker for Sentry Cocoa framework.
65+
// Default is enabled.
66+
enabled = true
67+
68+
// Path to the Xcode project that will be used to link the framework.
69+
// This is used to find the derived data path in which the framework is stored for SPM.
70+
// Default is the current project directory.
71+
xcodeProjectPath = "path/to/your/project.xcodeproj"
72+
73+
// Path to the framework that will be linked.
74+
// Takes precedence over xcodeprojPath if both are set.
75+
// Default is null.
76+
frameworkPath = "path/to/your/framework.framework"
77+
}
78+
}
79+
}
80+
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Configuration
33
description: "Additional configuration options for the SDK."
4-
sidebar_order: 5
4+
sidebar_order: 20
55
---
66

77
<PageGrid />

docs/platforms/kotlin-multiplatform/configuration/options.mdx

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ This variable controls the total amount of breadcrumbs that should be captured.
7575

7676
</ConfigKey>
7777

78-
<ConfigKey name="max-cache-items">
79-
80-
The maximum number of [envelopes](https://develop.sentry.dev/sdk/data-model/envelopes/) to keep in cache. The SDKs use envelopes to send data, such as events, attachments, user feedback, and sessions to sentry.io. An envelope can contain multiple items, such as an event with a session and two attachments. Depending on the usage of the SDK, the size of an envelope can differ. If the number of envelopes in the local cache exceeds `max-cache-items`, the SDK deletes the oldest envelope and migrates the sessions to the next envelope to maintain the integrity of your release health stats. The default is `30`.
81-
82-
</ConfigKey>
83-
8478
<ConfigKey name="attach-stacktrace">
8579

8680
When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to exceptions; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages.
@@ -91,93 +85,6 @@ Grouping in Sentry is different for events with stack traces and without. As a r
9185

9286
</ConfigKey>
9387

94-
<ConfigKey name="send-default-pii">
95-
96-
If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. By default, no such data is sent.
97-
98-
<Note>
99-
100-
If you are using Sentry in your mobile app, read our [frequently asked questions about mobile data privacy](/security-legal-pii/security/mobile-privacy/) to assist with Apple App Store and Google Play app privacy details.
101-
102-
</Note>
103-
104-
This option is turned off by default.
105-
106-
If you enable this option, be sure to manually remove what you don't want to send using our features for managing [_Sensitive Data_](../../data-management/sensitive-data/).
107-
108-
</ConfigKey>
109-
110-
<ConfigKey name="server-name">
111-
112-
This option can be used to supply a "server name." When provided, the name of the server is sent along and persisted in the event. For many integrations, the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server.
113-
114-
Most SDKs will attempt to auto-discover this value.
115-
116-
</ConfigKey>
117-
118-
<ConfigKey name="in-app-include">
119-
120-
A list of string prefixes of module names that belong to the app. This option takes precedence over `in-app-exclude`.
121-
122-
Sentry differentiates stack frames that are directly related to your application ("in application") from stack frames that come from other packages such as the standard library, frameworks, or other dependencies. The application package is automatically marked as `inApp`. The difference is visible in [sentry.io](https://sentry.io), where only the "in application" frames are displayed by default.
123-
124-
</ConfigKey>
125-
126-
<ConfigKey name="in-app-exclude">
127-
128-
A list of string prefixes of module names that do not belong to the app, but rather to third-party packages. Modules considered not part of the app will be hidden from stack traces by default.
129-
130-
This option can be overridden using <PlatformIdentifier name="in-app-include" />.
131-
132-
</ConfigKey>
133-
134-
<ConfigKey name="ignored-exceptions-for-type">
135-
136-
A list of exception types that will be filtered out before sending to Sentry.
137-
138-
</ConfigKey>
139-
140-
<ConfigKey name="max-request-body-size">
141-
142-
This parameter controls whether integrations should capture HTTP request bodies. It can be set to one of the following values:
143-
144-
- `never`: Request bodies are never sent.
145-
- `small`: Only small request bodies will be captured. The cutoff for small depends on the SDK (typically 4KB).
146-
- `medium`: Medium and small requests will be captured (typically 10KB).
147-
- `always`: The SDK will always capture the request body as long as Sentry can make sense of it.
148-
149-
</ConfigKey>
150-
151-
<ConfigKey name="enabled">
152-
153-
Specifies whether this SDK should send events to Sentry. Defaults to `true`. Setting this to `enabled: false` doesn't prevent all overhead from Sentry instrumentation. To disable Sentry completely, depending on environment, call `Sentry.init` conditionally.
154-
155-
</ConfigKey>
156-
157-
<ConfigKey name="send-client-reports">
158-
159-
Set this boolean to `false` to disable sending of client reports. Client reports are a protocol feature that let clients send status reports about themselves to Sentry. They are currently mainly used to emit outcomes for events that were never sent.
160-
161-
_(New in version 6.0.0)_
162-
163-
</ConfigKey>
164-
165-
## Integration Configuration
166-
167-
For many platform SDKs integrations can be configured alongside it. On some platforms that happen as part of the `init()` call, in some others, different patterns apply.
168-
169-
<ConfigKey name="integrations" />
170-
171-
In some SDKs, the integrations are configured through this parameter on library initialization. For more information, please see our documentation for a specific integration.
172-
173-
<ConfigKey name="default-integrations" notSupported={["java", "dart"]} />
174-
175-
This can be used to disable integrations that are added by default. When set to `false`, no default integrations are added.
176-
177-
<ConfigKey name="auto-enabling-integrations" supported={["python"]} />
178-
179-
This can be used to disable integrations that are enabled by default if the SDK detects that the corresponding framework or library is installed. When set to `false`, none of these integrations will be enabled by default, even if the corresponding framework/library is detected.
180-
18188
## Hooks
18289

18390
These options can be used to hook the SDK in various ways to customize the reporting of events.
@@ -203,36 +110,8 @@ The callback typically gets a second argument (called a "hint") which contains t
203110

204111
</ConfigKey>
205112

206-
## Transport Options
207-
208-
Transports are used to send events to Sentry. Transports can be customized to some degree to better support highly specific deployments.
209-
210-
<ConfigKey name="transport">
211-
212-
Switches out the transport used to send events. How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to send it through some more complex setup that requires proxy authentication.
213-
214-
</ConfigKey>
215-
216-
<ConfigKey name="http-proxy">
217-
218-
When set, a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate `https-proxy` is configured. However, not all SDKs support a separate HTTPS proxy. SDKs will attempt to default to the system-wide configured proxy, if possible. For instance, on Unix systems, the `http_proxy` environment variable will be picked up.
219-
220-
</ConfigKey>
221-
222-
<ConfigKey name="shutdown-timeout">
223-
224-
Controls how many seconds to wait before shutting down. Sentry SDKs send events from a background queue. This queue is given a certain amount to drain pending events. The default is SDK specific but typically around two seconds. Setting this value too low may cause problems for sending events from command line applications. Setting the value too high will cause the application to block for a long time for users experiencing network connectivity problems.
225-
226-
</ConfigKey>
227-
228113
## Tracing Options
229114

230-
<ConfigKey name="enable-tracing">
231-
232-
A boolean value, if true, transactions and trace data will be generated and captured. This will set the <PlatformIdentifier name="traces-sample-rate" /> to the recommended default of 1.0 if <PlatformIdentifier name="traces-sample-rate" /> is not defined. Note that <PlatformIdentifier name="traces-sample-rate" /> and <PlatformIdentifier name="traces-sampler" /> take precedence over this option.
233-
234-
</ConfigKey>
235-
236115
<ConfigKey name="traces-sample-rate">
237116

238117
A number between 0 and 1, controlling the percentage chance a given transaction will be sent to Sentry. (0 represents 0% while 1 represents 100%.) Applies equally to all transactions created in the app. Either this or <PlatformIdentifier name="traces-sampler" /> must be defined to enable tracing.
@@ -256,9 +135,3 @@ String entries do not have to be full matches, meaning the URL of a request is m
256135
If <PlatformIdentifier name="trace-propagation-targets" /> is not provided, trace data is attached to every outgoing request from the instrumented client.
257136

258137
</ConfigKey>
259-
260-
<ConfigKey name="trace-options-requests">
261-
262-
Set this boolean to `false` to disable tracing for `OPTIONS` requests. This options default value will likely be changed in the next major version, meaning you will have to set it to `true` if you want to keep tracing `OPTIONS` requests.
263-
264-
</ConfigKey>

docs/platforms/kotlin-multiplatform/debug-symbols.mdx renamed to docs/platforms/kotlin-multiplatform/debug-symbols/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Upload Debug Symbols
33
description: "Learn more about how to upload debug symbols in Sentry Kotlin Multiplatform."
4-
sidebar_order: 4
4+
sidebar_order: 6
55
---
66

77
To symbolicate your stack traces, you need to provide debug information to Sentry.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Features
3+
sidebar_order: 1
4+
description: "Learn about the features of Sentry's Kotlin Multiplatform SDK."
5+
---
6+
7+
Sentry's Kotlin Multiplatform SDK enables automatic reporting of errors and exceptions.
8+
Because the SDK provides a unified API for all supported platforms directly leveraging the native SDKs for each platform, it also supports the same features as the native SDKs. Click on a link below to see relevant features for your platform:
9+
10+
- [Apple features](/platforms/apple/features)
11+
- [Android features](/platforms/android/features)
12+
- [Java features](/platforms/java)
13+
14+
<Note>
15+
Some functionality may not be available in the shared Kotlin Multiplatform layer yet. You may have to use the native SDKs directly, or write your own platform-specific code.
16+
17+
To access the native SDK init options, use the [Native Platform Options initialization](/platforms/kotlin-multiplatform/initialization-strategies/#native-platform-options).
18+
</Note>
19+
20+
## Supported Platforms
21+
22+
The table below lists supported platforms and their corresponding presets.
23+
24+
| Target Platform | Target Preset |
25+
| --------------- | ------------------------------------------------------------------------------------------------------------ |
26+
| Android | <ul><li>`androidTarget`</li></ul> |
27+
| Kotlin/JVM | <ul><li>`jvm`</li></ul> |
28+
| iOS | <ul><li>`iosArm64`</li><li>`iosX64`</li><li>`iosSimulatorArm64`</li></ul> |
29+
| macOS | <ul><li>`macosArm64`</li><li>`macosX64`</li></ul> |
30+
| watchOS | <ul><li>`watchosArm32`</li><li>`watchosArm64`</li><li>`watchosX64`</li><li>`watchosSimulatorArm64`</li></ul> |
31+
| tvOS | <ul><li>`tvosArm64`</li><li>`tvosX64`</li><li>`tvosSimulatorArm64`</li></ul> |
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Kotlin Multiplatform
33
caseStyle: camelCase
4-
fallbackPlatform: java
54
supportLevel: production
65
sdk: sentry.kotlin.kmp
76
categories:
@@ -38,36 +37,9 @@ Learn more about manually capturing an error or message in our <PlatformLink to=
3837

3938
To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
4039

41-
## Supported Platforms
40+
## Next Steps
4241

43-
The table below lists supported platforms and their corresponding presets.
44-
45-
| Target Platform | Target Preset |
46-
| --------------- | ------------------------------------------------------------------------------------------------------------ |
47-
| Android | <ul><li>`androidTarget`</li></ul> |
48-
| Kotlin/JVM | <ul><li>`jvm`</li></ul> |
49-
| iOS | <ul><li>`iosArm64`</li><li>`iosX64`</li><li>`iosSimulatorArm64`</li></ul> |
50-
| macOS | <ul><li>`macosArm64`</li><li>`macosX64`</li></ul> |
51-
| watchOS | <ul><li>`watchosArm32`</li><li>`watchosArm64`</li><li>`watchosX64`</li><li>`watchosSimulatorArm64`</li></ul> |
52-
| tvOS | <ul><li>`tvosArm64`</li><li>`tvosX64`</li><li>`tvosSimulatorArm64`</li></ul> |
53-
54-
## Overview of Features
55-
56-
- Native crash reporting for Android and JVM, leveraging our [Android SDK](/platforms/android) and [Java SDK](/platforms/java)
57-
- Native crash reporting for iOS, macOS, tvOS, and watchOS, leveraging our [Cocoa SDK](/platforms/apple)
58-
- Automatic breadcrumbs for app lifecycle and UI events
59-
60-
## Apple Installation Methods
61-
62-
### Swift Package Manager (SPM)
63-
64-
Swift Package Manager (SPM) is a powerful tool for managing dependencies in Swift that allows developers to enjoy a more native integration experience with Xcode.
65-
If you already use SPM or prefer it over other package managers on Apple platforms, this guide will show you how to install the Kotlin Multiplatform SDK while using Swift Package Manager.
66-
67-
#### Install
68-
69-
In order to install the Sentry Kotlin Multiplatform SDK, you need to use Cocoapods and Swift Package Manager simultaneously which might seem unconventional at first, especially if you're accustomed to using SPM for all your dependencies. However, you can achieve a smooth integration by using the Kotlin Cocoapods plugin specifically for compiling and building the shared framework. You can then continue to manage all other dependencies with SPM as usual.
70-
71-
Follow the steps for our primary installation method [Cocoapods](/platforms/kotlin-multiplatform/#install) to install the Sentry Kotlin Multiplatform SDK.
72-
73-
After you've consumed the shared framework in your application via Cocoapods, you can continue with SPM for other dependencies without disrupting your existing workflow.
42+
- <PlatformLink to="/features">Learn more about Sentry's Kotlin Multiplatform SDK features</PlatformLink>
43+
- <PlatformLink to="/initialization-strategies">Learn about different ways to initialize the SDK</PlatformLink>
44+
- <PlatformLink to="/configuration/gradle">See configuration options for the Kotlin Multiplatform Gradle Plugin</PlatformLink>
45+
- <PlatformLink to="/debug-symbols">Add readable stack traces to your errors</PlatformLink>

0 commit comments

Comments
 (0)