Skip to content

Commit 47b1413

Browse files
authored
Adding sentryTag in compose docs (#10051)
* Replace testTag with sentryTag * Add testTag again
1 parent a8dc27e commit 47b1413

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

docs/platforms/android/integrations/jetpack-compose/index.mdx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Once performance metrics have been enabled, you'll see two spans inside your tra
3838
- `ui.compose.composition`, describing the time it took to execute your `@Composable`
3939
- `ui.compose.rendering`, describing the time it took to render your `@Composable` to the canvas
4040

41-
The `SentryTraced` function also provides an `enableUserInteractionTracing` argument, which automatically applies a `Modifier.testTag()` and enables the _User Interactions_ feature mentioned below.
41+
The `SentryTraced` function also provides an `enableUserInteractionTracing` argument, which automatically applies a `Modifier.sentryTag()` and enables the _User Interactions_ feature mentioned below.
4242

4343
### Installation
4444

@@ -110,17 +110,20 @@ SentryAndroid.init(this) { options ->
110110
}
111111
```
112112

113-
The Sentry SDK utilizes the built-in `Modifier.testTag("<tag>")` of a Composable to determine its identifier. Here's an example:
113+
#### Capture Composables
114+
115+
The Sentry SDK requires you to have either `Modifier.sentryTag("<tag>")` or `Modifier.testTag("<tag>")` applied on each `@Composable` you want to capture to determine its identifier.
116+
Here's an example:
114117

115118
```kotlin
116-
import androidx.compose.ui.platform.testTag
119+
import io.sentry.compose.sentryTag
117120

118121
@Composable
119122
fun LoginScreen() {
120123
Column {
121124
// ...
122125
Button(
123-
modifier = Modifier.testTag("button_login"),
126+
modifier = Modifier.sentryTag("button_login"),
124127
onClick = { TODO() }) {
125128
Text(text = "Login")
126129
}
@@ -130,7 +133,8 @@ fun LoginScreen() {
130133

131134
<Note>
132135

133-
If a `@Composable` doesn't have a `testTag` modifier applied, both breadcrumbs and transactions won't be captured because they can't be uniquely identified. To automatically generate tags, refer to the docs about our <PlatformLink to="/enhance-errors/kotlin-compiler-plugin/">Sentry Kotlin Compiler Plugin</PlatformLink>.
136+
If a `@Composable` doesn't have a `.sentryTag` or a `.testTag` modifier applied, both breadcrumbs and transactions won't be captured because they can't be uniquely identified.
137+
To automatically generate tags, refer to the docs about our <PlatformLink to="/enhance-errors/kotlin-compiler-plugin/">Sentry Kotlin Compiler Plugin</PlatformLink>.
134138

135139
</Note>
136140

docs/platforms/android/performance/instrumentation/automatic-instrumentation.mdx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,18 @@ If the view doesn't have the `id` assigned, the transaction won't be captured be
278278

279279
_(New in version 6.10.0)_
280280

281-
The SDK composes the transaction name out of the host `Activity` and the `tag` set by way of the `Modifier.testTag("<tag>")` of the `Composable` (for example, `LoginActivity.login_button`). The transaction operation is set to `ui.action` plus the interaction type (one of `click`, `scroll`, or `swipe`).
281+
The SDK composes the transaction name out of the host `Activity` and the `tag` set by way of the `Modifier.sentryTag("<tag>")` of the `Composable` (for example, `LoginActivity.login_button`).
282+
The transaction operation is set to `ui.action` plus the interaction type (one of `click`, `scroll`, or `swipe`).
282283

283284
```kotlin
284-
import androidx.compose.ui.platform.testTag
285+
import io.sentry.compose.sentryTag
285286

286287
@Composable
287288
fun LoginScreen() {
288289
Column {
289290
// ...
290291
Button(
291-
modifier = Modifier.testTag("button_login"),
292+
modifier = Modifier.sentryTag("button_login"),
292293
onClick = { TODO() }) {
293294
Text(text = "Login")
294295
}
@@ -298,7 +299,8 @@ fun LoginScreen() {
298299

299300
<Note>
300301

301-
If the `@Composable` doesn't have a `testTag` modifier applied, the transaction won't be captured because it can't be uniquely identified. To capture a transaction for the `@Composable`, you must either add a `testTag` modifier or enable automatic `@Composable` tagging.
302+
If the `@Composable` doesn't have a `sentryTag` modifier applied, the transaction won't be captured because it can't be uniquely identified.
303+
To capture a transaction for the `@Composable`, you must either add a `sentryTag` modifier or enable automatic `@Composable` tagging.
302304

303305
</Note>
304306

@@ -310,7 +312,9 @@ The Sentry Kotlin Compiler plugin is considered _experimental_. Give it a try an
310312

311313
</Note>
312314

313-
The <PlatformLink to="/enhance-errors/kotlin-compiler-plugin/">Sentry Kotlin Compiler Plugin</PlatformLink> can automatically enrich your `@Composable` functions during compilation with a tag name, based on the function name of your `@Composable`. In order to use this feature, the Sentry Kotlin Compiler plugin needs to be applied to all modules, which contain `@Composable` elements.
315+
The <PlatformLink to="/enhance-errors/kotlin-compiler-plugin/">Sentry Kotlin Compiler Plugin</PlatformLink> can automatically enrich your `@Composable` functions during compilation with a tag name,
316+
based on the function name of your `@Composable`.
317+
In order to use this feature, the Sentry Kotlin Compiler plugin needs to be applied to all modules, which contain `@Composable` elements.
314318

315319
```groovy {filename:app/build.gradle}
316320
plugins {

0 commit comments

Comments
 (0)