Skip to content

Commit 2e2e004

Browse files
michellewzhangaliu39
authored andcommitted
feat(flags): add unleash to provider dropdowns and onboarding (#82836)
branched off of #82387 closes getsentry/team-replay#515 closes getsentry/team-replay#530 ### settings page <img width="995" alt="SCR-20250102-mncr" src="https://github.com/user-attachments/assets/6404d15c-94da-41e1-8c13-5215bf2c5b66" /> <img width="997" alt="SCR-20250102-mnew" src="https://github.com/user-attachments/assets/e15f10df-ba01-48ed-9f29-75db4fc745ef" /> ### onboarding dropdowns <img width="450" alt="SCR-20250102-mnbf" src="https://github.com/user-attachments/assets/b9a733e4-dc98-4217-baca-9d1ed95d8980" /> <img width="435" alt="SCR-20250102-mnag" src="https://github.com/user-attachments/assets/f05a781f-752a-4f4c-a4d3-af217773c6a3" /> ### python onboarding <img width="467" alt="SCR-20250107-jlgk" src="https://github.com/user-attachments/assets/978a31ff-3929-480f-ae24-2d2cc48c17f8" /> ### js onboarding <img width="472" alt="SCR-20250114-jlyw" src="https://github.com/user-attachments/assets/0c43d47d-15fe-4d3e-ae8d-85cf8afe3f12" /> ### also updated generic python onboarding: <img width="477" alt="SCR-20250114-kyvf" src="https://github.com/user-attachments/assets/99aa6824-9e27-4b9f-96cc-3e548c5c8852" /> --------- Co-authored-by: Andrew Liu <[email protected]>
1 parent bcfc102 commit 2e2e004

File tree

5 files changed

+61
-16
lines changed

5 files changed

+61
-16
lines changed

static/app/components/events/featureFlags/onboardingIntegrationSection.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import {
99
import {hasEveryAccess} from 'sentry/components/acl/access';
1010
import Alert from 'sentry/components/alert';
1111
import {Button} from 'sentry/components/button';
12-
import {PROVIDER_OPTION_TO_URLS} from 'sentry/components/events/featureFlags/utils';
12+
import {
13+
PROVIDER_OPTION_TO_URLS,
14+
ProviderOptions,
15+
} from 'sentry/components/events/featureFlags/utils';
1316
import Input from 'sentry/components/input';
1417
import ExternalLink from 'sentry/components/links/externalLink';
1518
import TextCopyInput from 'sentry/components/textCopyInput';
@@ -114,9 +117,13 @@ export default function OnboardingIntegrationSection({
114117
</SubSection>
115118
<SubSection>
116119
<div>
117-
{t(
118-
"During the process of creating a webhook integration, you'll be given the option to sign the webhook. This is an auto-generated secret code that Sentry requires to verify requests from your feature flag service. Paste the secret below."
119-
)}
120+
{provider === ProviderOptions.UNLEASH
121+
? t(
122+
`During the process of creating a webhook integration, you'll be given the option to add an authorization header. This is a string (or "secret") that you choose so that Sentry can verify requests from your feature flag service. Paste your authorization string below.`
123+
)
124+
: t(
125+
"During the process of creating a webhook integration, you'll be given the option to sign the webhook. This is an auto-generated secret code that Sentry requires to verify requests from your feature flag service. Paste the secret below."
126+
)}
120127
</div>
121128
<InputTitle>{t('Secret')}</InputTitle>
122129
<InputArea>

static/app/components/events/featureFlags/utils.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,21 @@ export const sortedFlags = ({
116116
export enum ProviderOptions {
117117
LAUNCHDARKLY = 'LaunchDarkly',
118118
GENERIC = 'Generic',
119+
UNLEASH = 'Unleash',
119120
}
120121

121122
export enum IntegrationOptions {
122123
LAUNCHDARKLY = 'LaunchDarkly',
123124
OPENFEATURE = 'OpenFeature',
124125
GENERIC = 'Generic',
126+
UNLEASH = 'Unleash',
125127
}
126128

127129
export const PROVIDER_OPTION_TO_URLS: Record<ProviderOptions, string | undefined> = {
128130
[ProviderOptions.LAUNCHDARKLY]:
129131
'https://app.launchdarkly.com/settings/integrations/webhooks/new?q=Webhooks',
132+
[ProviderOptions.UNLEASH]:
133+
'https://docs.sentry.io/organization/integrations/feature-flag/unleash/#set-up-change-tracking',
130134
[ProviderOptions.GENERIC]:
131135
'https://docs.sentry.io/organization/integrations/feature-flag/generic/#set-up-change-tracking',
132136
};

static/app/gettingStartedDocs/javascript/javascript.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ client.addHooks(new Sentry.OpenFeatureIntegrationHook());
9292
9393
// Evaluating flags will record the result on the Sentry client.
9494
const result = client.getBooleanValue('my-flag', false);`,
95+
},
96+
[IntegrationOptions.UNLEASH]: {
97+
importStatement: `import { UnleashClient } from 'unleash-proxy-client';`,
98+
integration: 'unleashIntegration(UnleashClient)',
99+
sdkInit: `const unleash = new UnleashClient({
100+
url: "https://<your-unleash-instance>/api/frontend",
101+
clientKey: "<your-client-side-token>",
102+
appName: "my-webapp",
103+
});
104+
105+
unleash.start();
106+
107+
// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
108+
unleash.isEnabled("test-flag");
109+
110+
Sentry.captureException(new Error("Something went wrong!"));`,
95111
},
96112
[IntegrationOptions.GENERIC]: {
97113
importStatement: ``,

static/app/gettingStartedDocs/python/python.tsx

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ type FlagImports = {
2424

2525
const FLAG_OPTION_TO_IMPORT: Record<IntegrationOptions, FlagImports> = {
2626
[IntegrationOptions.LAUNCHDARKLY]: {
27-
module: 'launchdarkly',
27+
module: 'integrations.launchdarkly',
2828
integration: 'LaunchDarklyIntegration',
2929
},
3030
[IntegrationOptions.OPENFEATURE]: {
31-
module: 'openfeature',
31+
module: 'integrations.openfeature',
3232
integration: 'OpenFeatureIntegration',
3333
},
34+
[IntegrationOptions.UNLEASH]: {
35+
module: 'integrations.unleash',
36+
integration: 'UnleashIntegration',
37+
},
3438
[IntegrationOptions.GENERIC]: {
3539
module: 'feature_flags',
36-
integration: 'FeatureFlagsIntegration',
40+
integration: '',
3741
},
3842
};
3943

@@ -184,7 +188,7 @@ export const performanceOnboarding: OnboardingConfig = {
184188
),
185189
language: 'python',
186190
code: `
187-
import sentry-sdk
191+
import sentry_sdk
188192
189193
sentry_sdk.init(
190194
dsn="${params.dsn.public}",
@@ -252,17 +256,30 @@ export const featureFlagOnboarding: OnboardingConfig = {
252256
configure: ({featureFlagOptions = {integration: ''}, dsn}) => [
253257
{
254258
type: StepType.CONFIGURE,
255-
description: tct('Add [name] to your integrations list.', {
256-
name: (
257-
<code>{`${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}()`}</code>
258-
),
259-
}),
259+
description:
260+
featureFlagOptions.integration === IntegrationOptions.GENERIC
261+
? `This provider doesn't use an integration. Simply initialize Sentry and import the API.`
262+
: tct('Add [name] to your integrations list.', {
263+
name: (
264+
<code>{`${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}()`}</code>
265+
),
266+
}),
260267
configurations: [
261268
{
262269
language: 'python',
263-
code: `
264-
import sentry-sdk
265-
from sentry_sdk.integrations.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}
270+
code:
271+
featureFlagOptions.integration === IntegrationOptions.GENERIC
272+
? `import sentry_sdk
273+
from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import add_feature_flag
274+
275+
sentry_sdk.init(
276+
dsn="${dsn.public}",
277+
integrations=[
278+
# your other integrations here
279+
]
280+
)`
281+
: `import sentry_sdk
282+
from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}
266283
267284
sentry_sdk.init(
268285
dsn="${dsn.public}",

static/app/views/settings/featureFlags/newProviderForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export default function NewProviderForm({
119119
options={[
120120
{value: 'LaunchDarkly', label: 'LaunchDarkly'},
121121
{value: 'Generic', label: 'Generic'},
122+
{value: 'Unleash', label: 'Unleash'},
122123
]}
123124
help={t(
124125
'If you have already linked this provider, pasting a new secret will override the existing secret.'

0 commit comments

Comments
 (0)