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(flags): Add OpenFeature JS integration docs #11837

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: OpenFeature
description: "Attaches recent OpenFeature feature flag evaluations to error event context."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "Attaches recent OpenFeature feature flag evaluations to error event context."
description: "Learn how to attach Sentry's OpenFeature feature flag evaluations to error event context."

notSupported:
- javascript.aws-lambda
- javascript.azure-functions
- javascript.bun
- javascript.capacitor
- javascript.cloudflare
- javascript.connect
- javascript.cordova
- javascript.deno
- javascript.electron
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.koa
- javascript.nestjs
- javascript.nodejs
- javascript.wasm
---

<Alert level="info">

This integration only works inside a browser environment.

</Alert>

_Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_
Copy link
Member

@michellewzhang michellewzhang Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should also add an alert saying this is in beta to match the other docs (same with the LD JS doc too)

i've been doing this:

<Alert level="info" title="Currently in Beta">

The support for **feature flag change tracking** and **feature flag evaluation tracking** is currently in beta.

</Alert>


The [OpenFeature](https://https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, in the event an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.**
Copy link
Contributor

@lizokm lizokm Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [OpenFeature](https://https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, in the event an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.**
The [OpenFeature](https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, if an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.**


```JavaScript
import * as Sentry from '@sentry/browser';
import { OpenFeature } from '@openfeature/web-sdk';

Sentry.init({integrations: [Sentry.openFeatureIntegration()]});

const client = OpenFeature.getClient();
client.addHooks(new Sentry.OpenFeatureIntegrationHook());

// Evaluating flags will record the result on the Sentry client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Evaluating flags will record the result on the Sentry client.
// When you evaluate flags, the result will be recorded by the Sentry client.

const result = client.getBooleanValue('my-flag', false);
```

Learn more about the OpenFeature SDK at https://github.com/open-feature/js-sdk/tree/main.

## Options

There are no setup options for this integration.
Comment on lines +49 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Options
There are no setup options for this integration.
## Options
There are no setup options for this integration.

Maybe it's better to just not have this section since there aren't any options?

Loading