Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS-9781] Add RN tabs to Custom Grouping Error Tracking #26891

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 83 additions & 57 deletions content/en/error_tracking/custom_grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,19 @@ In Datadog's mobile SDKs, you can add a custom error fingerprint when logging an
a predefined attribute to the log call:

{{< tabs >}}

{{% tab "Android" %}}
To use custom grouping, you need the Datadog Android SDK `2.7.0` or higher.

```kotlin
val errorFingerprint = "my-custom-grouping-material"
val attributes = mapOf(LogAttributes.ERROR_FINGERPRINT to errorFingerprint)
logger.e("My error message", error, attributes)
```

{{% /tab %}}
{{% tab "iOS" %}}

To use custom grouping, you need the Datadog iOS SDK `2.8.1` or higher.

```swift
Expand All @@ -92,18 +104,8 @@ logger.error(
)
```
{{% /tab %}}

{{% tab "Android" %}}
To use custom grouping, you need the Datadog Android SDK `2.7.0` or higher.

```kotlin
val errorFingerprint = "my-custom-grouping-material"
val attributes = mapOf(LogAttributes.ERROR_FINGERPRINT to errorFingerprint)
logger.e("My error message", error, attributes)
```
{{% /tab %}}

{{% tab "Flutter" %}}

To use custom grouping, you need the Datadog Flutter SDK `2.4.0` or higher.

```dart
Expand All @@ -117,28 +119,18 @@ logger.error(
);
```
{{% /tab %}}
{{< /tabs >}}
{{% tab "React Native" %}}

Or, you can add or adjust the fingerprint in the log mapper:
To use custom grouping, you need the Datadog React Native SDK `2.4.2` or higher.

{{< tabs >}}
{{% tab "iOS" %}}
To use custom grouping, you need the Datadog iOS SDK `2.8.1` or higher.
TK

```swift
let logsConfiguration = Logs.Configuration(
eventMapper: { log in
var log = log
log.error?.fingerprint = "my-custom-grouping-material"
return log
}
)
Logs.enable(
with: logsConfiguration
)
```
{{% /tab %}}
{{< /tabs >}}

Or, you can add or adjust the fingerprint in the log mapper:

{{< tabs >}}
{{% tab "Android" %}}
To use custom grouping, you need the Datadog Android SDK `2.7.0` or higher.

Expand All @@ -156,6 +148,23 @@ Logs.enable(logsConfiguration)
```
{{% /tab %}}

{{% tab "iOS" %}}
To use custom grouping, you need the Datadog iOS SDK `2.8.1` or higher.

```swift
let logsConfiguration = Logs.Configuration(
eventMapper: { log in
var log = log
log.error?.fingerprint = "my-custom-grouping-material"
return log
}
)
Logs.enable(
with: logsConfiguration
)
```
{{% /tab %}}

{{% tab "Flutter" %}}
To use custom grouping, you need the Datadog Flutter SDK `2.4.0` or higher.

Expand All @@ -174,6 +183,14 @@ final configuration = DatadogConfiguration(
loggingConfiguration: loggingConfiguration,
);
```
{{% /tab %}}

{{% tab "React Native" %}}

To use custom grouping, you need the Datadog React Native SDK `2.4.2` or higher.

TK

{{% /tab %}}
{{< /tabs >}}

Expand Down Expand Up @@ -217,35 +234,6 @@ In both cases, `my-custom-grouping-material` is used to group the Browser RUM er
[2]: https://github.com/DataDog/browser-sdk/releases/tag/v4.42.0
{{% /tab %}}

{{% tab "iOS" %}}
To use custom grouping, you need the Datadog iOS SDK `2.8.1` or higher.

To add a custom fingerprint when manually reporting errors, you can add a predefined attribute when calling `addError`:

```swift
RUMMonitor.shared().addError(
message: "My error message",
source: .source,
attributes: [
RUM.Attributes.errorFingerprint: "my-custom-grouping-fingerprint"
]
)
```

Or, you can use the `errorEventMapper`:

```swift
var config = RUM.Configuration(applicationID: "rum-application-id")
config.errorEventMapper = { errorEvent in
var errorEvent = errorEvent
errorEvent.error.fingerprint = "my-custom-grouping-fingerprint"
return errorEvent
}
RUM.enable(with: config)
```

{{% /tab %}}

{{% tab "Android" %}}
To use custom grouping, you need the Datadog Android SDK `2.7.0` or higher.

Expand Down Expand Up @@ -277,6 +265,35 @@ RUM.enable(rumConfiguration)

{{% /tab %}}

{{% tab "iOS" %}}
To use custom grouping, you need the Datadog iOS SDK `2.8.1` or higher.

To add a custom fingerprint when manually reporting errors, you can add a predefined attribute when calling `addError`:

```swift
RUMMonitor.shared().addError(
message: "My error message",
source: .source,
attributes: [
RUM.Attributes.errorFingerprint: "my-custom-grouping-fingerprint"
]
)
```

Or, you can use the `errorEventMapper`:

```swift
var config = RUM.Configuration(applicationID: "rum-application-id")
config.errorEventMapper = { errorEvent in
var errorEvent = errorEvent
errorEvent.error.fingerprint = "my-custom-grouping-fingerprint"
return errorEvent
}
RUM.enable(with: config)
```

{{% /tab %}}

{{% tab "Flutter" %}}
To use custom grouping, you need the Datadog Flutter SDK `2.4.0` or higher.

Expand Down Expand Up @@ -311,6 +328,15 @@ final configuration = DatadogConfiguration(
);
```
{{% /tab %}}

{{% tab "React Native" %}}

To use custom grouping, you need the Datadog React Native SDK `2.4.2` or higher.

TK

{{% /tab %}}

{{< /tabs >}}

[1]: /tracing/
Expand Down
Loading