Skip to content
Merged
27 changes: 27 additions & 0 deletions docs/platforms/dart/common/feature-flags/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Set Up Feature Flags
sidebar_order: 7000
description: With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log of feature flag changes, and reports any suspicious updates that may have caused an error.
---

<PlatformContent includePath="feature-flags/prerelease-alert" />

## Prerequisites

- [Sentry SDK](/platforms/dart/#configure) version `9.0.0`.

## Enable Evaluation Tracking

If you use a third-party SDK to evaluate feature flags, you can enable Sentry to track those evaluations. Integrations are provider specific, and documentation for supported SDKs is listed below:

- [Firebase Remote Config](/platforms/dart/configuration/integrations/firebase-remote-config/)

### Manual Usage

Call `Sentry.addFeatureFlag` to track feature flag evaluations:

```dart
Sentry.addFeatureFlag("feature_flag_a", true);
```

Calling this function multiple times with the same flag name will override the previous value.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Firebase Remote Config
description: "Learn more about the Sentry Firebase Remote Config integration for the Dart SDK."
sidebar_order: 50
redirect_from:
- /platforms/dart/guides/firebase-remote-config/
---

<Include name="dart-integrations/firebase-remote-config.mdx" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Firebase Remote Config
description: "Learn more about the Sentry Firebase Remote Config integration for the Flutter SDK."
sidebar_order: 60
redirect_from:
- /platforms/dart/guides/flutter/firebase-remote-config/
---

<Include name="dart-integrations/firebase-remote-config.mdx" />
2 changes: 1 addition & 1 deletion docs/platforms/javascript/common/feature-flags/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ notSupported:
- javascript.nestjs
- javascript.node
- javascript.wasm
description: With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log feature flag changes, and reports any suspicious updates that may have caused an error.
description: With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log of feature flag changes, and reports any suspicious updates that may have caused an error.
---

<PlatformContent includePath="feature-flags/prerelease-alert" />
Expand Down
71 changes: 71 additions & 0 deletions includes/dart-integrations/firebase-remote-config.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Firebase Remote Config
description: "Learn more about the Sentry Firebase Remote Config integration for the Dart SDK."
sidebar_order: 6
platforms:
- flutter
---

The `sentry_firebase_remote_config` integration provides [Firebase Remote Config](https://firebase.google.com/docs/remote-config/get-started?platform=flutter) support for Sentry, providing insight into feature flag evaluations.

## Behavior

- Adding the `SentryFirebaseRemoteConfig` integration will automatically track feature flag evaluations.
- Only boolean values are supported.

## Prerequisites

1. [Sentry SDK](/platforms/dart/#configure) version `9.0.0` or higher.
2. Firebase Remote Config is set up.

## Install

To use the `SentryFirebaseRemoteConfig` integration, add the `sentry_firebase_remote_config` dependency.

```yml {filename:pubspec.yaml}
dependencies:
sentry: ^9.0.0
sentry_firebase_remote_config: ^9.0.0
```

## Configure

Add the `SentryFirebaseRemoteConfig` integration to the Sentry SDK initialization.

```dart
await SentryFlutter.init(
(options) {
options.addIntegration(
SentryFirebaseRemoteConfigIntegration(
firebaseRemoteConfig: firebaseRemoteConfig,
),
);
},
);
```

### Remote Config Update

The integration will automatically call `await remoteConfig.activate();` when the config is updated.
If you don't want this behavior, you can set `activateOnConfigUpdated` to `false`.

```dart
SentryFirebaseRemoteConfigIntegration(
firebaseRemoteConfig: firebaseRemoteConfig,
activateOnConfigUpdated: false,
),
```

## Verify & View

### 1. Update Firebase Remote Config Value

Update a boolean [Firebase Remote Config](https://firebase.google.com/docs/remote-config/get-started?platform=flutter) value to true. Keep in mind that values will be evaluated as bool if their string values are `true`, `false`, `1`, or `0`. So numerical values of `1` or `0` will be evaluated as `true` or `false` boolean values respectively.

### 2. View the Recorded Feature Flag Evaluation on Sentry.io

To view the recorded feature flag evaluation, log into [sentry.io](https://sentry.io) and open your project.

Flag evaluations will appear in the "Feature Flag" section of Issue Details page as a table, with "suspect" flag predictions highlighted in yellow.

![Flag Change Suspect](./img/SuspectFlag.png)
Binary file added includes/dart-integrations/img/SuspectFlag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion includes/dart-integrations/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| [`Slow and Frozen Frames`](/platforms/dart/guides/flutter/integrations/slow-and-frozen-frames-instrumentation) | ✓ * | | ✓ | |
| [`Sqflite`](/platforms/dart/guides/flutter/integrations/sqflite-instrumentation) | | | ✓ | |
| [`User Interaction`](/platforms/dart/guides/flutter/integrations/user-interaction-instrumentation) | | | ✓ | ✓ |

| [`Firebase Remote Config`](/platforms/dart/guides/flutter/integrations/firebase-remote-config) | | | | ✓ |
<Alert>

*Slow and Frozen Frames* should work automatically, however if `WidgetsFlutterBinding` is initialized before `SentryFlutter.init`, then this instrumentation will not work automatically.
Expand Down
4 changes: 4 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ const USER_DOCS_REDIRECTS: Redirect[] = [
from: '/platforms/dart/configuration/integrations/dio/',
to: '/platforms/dart/integrations/dio/',
},
{
from: '/platforms/dart/configuration/integrations/firebase-remote-config/',
to: '/platforms/dart/integrations/firebase-remote-config/',
},
{
from: '/quickstart/',
to: '/platforms/',
Expand Down
Loading