Skip to content

Commit 4c2c747

Browse files
committed
docstr
1 parent a1a1046 commit 4c2c747

File tree

1 file changed

+22
-8
lines changed
  • packages/browser/src/integrations/featureFlags/openfeature

1 file changed

+22
-8
lines changed

packages/browser/src/integrations/featureFlags/openfeature/integration.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1-
/**
2-
* OpenFeature integration.
3-
*
4-
* Add the openFeatureIntegration() function call to your integration lists.
5-
* Add the integration hook to your OpenFeature object.
6-
* - OpenFeature.getClient().addHooks(new OpenFeatureIntegrationHook());
7-
*/
81
import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';
92
import type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureClient, OpenFeatureHook } from './types';
103

114
import { defineIntegration } from '@sentry/core';
125
import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';
136

7+
/**
8+
* Sentry integration for capturing feature flags from the OpenFeature SDK.
9+
*
10+
* See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
11+
*
12+
* @example
13+
* ```
14+
* import * as Sentry from '@sentry/browser';
15+
* import { OpenFeature } from '@openfeature/web-sdk';
16+
*
17+
* OpenFeature.setProvider(new MyProviderOfChoice());
18+
* const client = OpenFeature.getClient();
19+
* const openFeatureIntegration = Sentry.openFeatureIntegration({openFeatureClient: client});
20+
*
21+
* Sentry.init({
22+
* dsn: '___PUBLIC_DSN___',
23+
* integrations: [openFeatureIntegration]
24+
* });
25+
* ```
26+
*/
1427
export const openFeatureIntegration = defineIntegration((openFeatureClient: OpenFeatureClient) => {
1528
return {
1629
name: 'OpenFeature',
@@ -26,7 +39,8 @@ export const openFeatureIntegration = defineIntegration((openFeatureClient: Open
2639
}) satisfies IntegrationFn;
2740

2841
/**
29-
* OpenFeature Hook class implementation.
42+
* OpenFeatureHook class implementation. Listens for flag evaluations and
43+
* updates the `flags` context in our Sentry scope.
3044
*/
3145
class OpenFeatureIntegrationHook implements OpenFeatureHook {
3246
/**

0 commit comments

Comments
 (0)