From f06d6a299b82c878f68ea9277553e3332a27cf77 Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:48:56 -0500 Subject: [PATCH 01/10] ref(flags): add generic provider onboarding --- .../featureFlagOnboardingSidebar.tsx | 18 ++++++++++++++---- .../onboardingIntegrationSection.tsx | 6 +++++- .../components/events/featureFlags/utils.tsx | 5 ++++- .../javascript/javascript.tsx | 13 +++++++++++++ .../app/gettingStartedDocs/python/python.tsx | 4 ++++ .../views/settings/featureFlags/index.spec.tsx | 1 - .../settings/featureFlags/newProviderForm.tsx | 5 ++++- .../organizationFeatureFlagsNewSecret.spec.tsx | 1 + 8 files changed, 45 insertions(+), 8 deletions(-) diff --git a/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx b/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx index ea3a6dbd5551ad..157f191be708d8 100644 --- a/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx +++ b/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx @@ -157,15 +157,20 @@ function OnboardingContent({ return window.location.hash; }, []); const skipConfig = ORIGINAL_HASH === FLAG_HASH_SKIP_CONFIG; - const openFeatureProviders = [ProviderOptions.LAUNCHDARKLY]; - const sdkProviders = [ProviderOptions.LAUNCHDARKLY]; + const openFeatureProviders = Object.values(ProviderOptions); + const sdkProviders = Object.values(ProviderOptions); // First dropdown: OpenFeature providers const openFeatureProviderOptions = openFeatureProviders.map(provider => { return { value: provider, textValue: provider, - label: {provider}, + label: + provider === ProviderOptions.GENERIC ? ( + {t('Custom')} + ) : ( + {provider} + ), }; }); @@ -180,7 +185,12 @@ function OnboardingContent({ return { value: provider, textValue: provider, - label: {provider}, + label: + provider === ProviderOptions.GENERIC ? ( + {t('Custom')} + ) : ( + {provider} + ), }; }); diff --git a/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx b/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx index aa67e54383bce2..058a6ddc1fac90 100644 --- a/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx +++ b/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx @@ -98,7 +98,11 @@ export default function OnboardingIntegrationSection({
{tct( "Create a webhook integration with your [link:feature flag service]. When you do so, you'll need to enter a URL, which you can find below.", - {link: } + { + link: PROVIDER_OPTION_TO_URLS[provider] ? ( + + ) : undefined, + } )}
{t('Webhook URL')} diff --git a/static/app/components/events/featureFlags/utils.tsx b/static/app/components/events/featureFlags/utils.tsx index 59b1814ecc91fc..6c8145d5669971 100644 --- a/static/app/components/events/featureFlags/utils.tsx +++ b/static/app/components/events/featureFlags/utils.tsx @@ -115,14 +115,17 @@ export const sortedFlags = ({ export enum ProviderOptions { LAUNCHDARKLY = 'LaunchDarkly', + GENERIC = 'Generic', } export enum IntegrationOptions { LAUNCHDARKLY = 'LaunchDarkly', OPENFEATURE = 'OpenFeature', + GENERIC = 'Generic', } -export const PROVIDER_OPTION_TO_URLS: Record = { +export const PROVIDER_OPTION_TO_URLS: Record = { [ProviderOptions.LAUNCHDARKLY]: 'https://app.launchdarkly.com/settings/integrations/webhooks/new?q=Webhooks', + [ProviderOptions.GENERIC]: undefined, }; diff --git a/static/app/gettingStartedDocs/javascript/javascript.tsx b/static/app/gettingStartedDocs/javascript/javascript.tsx index 2391e9228fe8eb..f6cfdbb84e63ca 100644 --- a/static/app/gettingStartedDocs/javascript/javascript.tsx +++ b/static/app/gettingStartedDocs/javascript/javascript.tsx @@ -93,6 +93,19 @@ client.addHooks(new Sentry.OpenFeatureIntegrationHook()); // Evaluating flags will record the result on the Sentry client. const result = client.getBooleanValue('my-flag', false);`, }, + [IntegrationOptions.GENERIC]: { + importStatement: ``, + integration: 'featureFlagsIntegration()', + sdkInit: `const flagsIntegration = Sentry.getClient()?.getIntegrationByName('FeatureFlags'); + +if (flagsIntegration) { + flagsIntegration.addFeatureFlag('test-flag', false); +} else { + // Something went wrong, check your DSN and/or integrations +} + +Sentry.captureException(new Error('Something went wrong!'));`, + }, }; const isAutoInstall = (params: Params) => diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index 0c0401b95f7996..a8665c95939a9f 100644 --- a/static/app/gettingStartedDocs/python/python.tsx +++ b/static/app/gettingStartedDocs/python/python.tsx @@ -31,6 +31,10 @@ const FLAG_OPTION_TO_IMPORT: Record = { module: 'openfeature', integration: 'OpenFeatureIntegration', }, + [IntegrationOptions.GENERIC]: { + module: 'featureflags', + integration: 'FeatureFlagsIntegration', + }, }; const getInstallSnippet = () => `pip install --upgrade sentry-sdk`; diff --git a/static/app/views/settings/featureFlags/index.spec.tsx b/static/app/views/settings/featureFlags/index.spec.tsx index 7fa2633f10616b..2f57c6392ce66b 100644 --- a/static/app/views/settings/featureFlags/index.spec.tsx +++ b/static/app/views/settings/featureFlags/index.spec.tsx @@ -49,7 +49,6 @@ describe('OrganizationFeatureFlagsIndex', function () { await waitForElementToBeRemoved(() => screen.queryByTestId('loading-indicator')); - // Then list expect(screen.getByText('launchdarkly')).toBeInTheDocument(); expect(screen.getByText('openfeature')).toBeInTheDocument(); diff --git a/static/app/views/settings/featureFlags/newProviderForm.tsx b/static/app/views/settings/featureFlags/newProviderForm.tsx index 9b68b62bc6a49c..21a6d0f51cd3d1 100644 --- a/static/app/views/settings/featureFlags/newProviderForm.tsx +++ b/static/app/views/settings/featureFlags/newProviderForm.tsx @@ -116,7 +116,10 @@ export default function NewProviderForm({ value={selectedProvider} placeholder={t('Select a provider')} name="provider" - options={[{value: 'LaunchDarkly', label: 'LaunchDarkly'}]} + options={[ + {value: 'LaunchDarkly', label: 'LaunchDarkly'}, + {value: 'Generic', label: 'Custom'}, + ]} help={t( 'If you have already linked this provider, pasting a new secret will override the existing secret.' )} diff --git a/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx b/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx index ca24a24f50c94a..293d31102cb0c0 100644 --- a/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx +++ b/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx @@ -70,6 +70,7 @@ describe('OrganizationFeatureFlagsNewSecret', function () { }); await userEvent.click(providerDropdown); await userEvent.click(screen.getByRole('menuitemradio', {name: 'LaunchDarkly'})); + await userEvent.click(screen.getByRole('menuitemradio', {name: 'Custom'})); await userEvent.click(screen.getByRole('button', {name: 'Add Provider'})); expect(indicators.addErrorMessage).toHaveBeenCalledWith( From 61e15ebe96792cd833c700401e57a0ec1391c96f Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:59:40 -0500 Subject: [PATCH 02/10] :white_check_mark: revert test --- .../featureFlags/organizationFeatureFlagsNewSecret.spec.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx b/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx index 293d31102cb0c0..ca24a24f50c94a 100644 --- a/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx +++ b/static/app/views/settings/featureFlags/organizationFeatureFlagsNewSecret.spec.tsx @@ -70,7 +70,6 @@ describe('OrganizationFeatureFlagsNewSecret', function () { }); await userEvent.click(providerDropdown); await userEvent.click(screen.getByRole('menuitemradio', {name: 'LaunchDarkly'})); - await userEvent.click(screen.getByRole('menuitemradio', {name: 'Custom'})); await userEvent.click(screen.getByRole('button', {name: 'Add Provider'})); expect(indicators.addErrorMessage).toHaveBeenCalledWith( From 1b28d1d1b989687db1ffe434b75e041971aa2ba6 Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Thu, 2 Jan 2025 13:41:01 -0800 Subject: [PATCH 03/10] :recycle: docs link todo --- .../events/featureFlags/onboardingIntegrationSection.tsx | 4 +--- static/app/components/events/featureFlags/utils.tsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx b/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx index 058a6ddc1fac90..058fe13a21f444 100644 --- a/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx +++ b/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx @@ -99,9 +99,7 @@ export default function OnboardingIntegrationSection({ {tct( "Create a webhook integration with your [link:feature flag service]. When you do so, you'll need to enter a URL, which you can find below.", { - link: PROVIDER_OPTION_TO_URLS[provider] ? ( - - ) : undefined, + link: , } )} diff --git a/static/app/components/events/featureFlags/utils.tsx b/static/app/components/events/featureFlags/utils.tsx index 6c8145d5669971..236da70c2e082f 100644 --- a/static/app/components/events/featureFlags/utils.tsx +++ b/static/app/components/events/featureFlags/utils.tsx @@ -127,5 +127,5 @@ export enum IntegrationOptions { export const PROVIDER_OPTION_TO_URLS: Record = { [ProviderOptions.LAUNCHDARKLY]: 'https://app.launchdarkly.com/settings/integrations/webhooks/new?q=Webhooks', - [ProviderOptions.GENERIC]: undefined, + [ProviderOptions.GENERIC]: 'DOCS LINK TODO', }; From 97068a601e69b491cf5480eb85d564bb5d50cadb Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Thu, 2 Jan 2025 13:58:55 -0800 Subject: [PATCH 04/10] feat(flags): add unleash to provider dropdowns and onboarding --- .../onboardingIntegrationSection.tsx | 15 ++++++++--- .../components/events/featureFlags/utils.tsx | 5 +++- .../javascript/javascript.tsx | 5 ++++ .../app/gettingStartedDocs/python/python.tsx | 27 ++++++++++++++++++- .../settings/featureFlags/newProviderForm.tsx | 1 + 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx b/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx index 058fe13a21f444..e75c2159c08484 100644 --- a/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx +++ b/static/app/components/events/featureFlags/onboardingIntegrationSection.tsx @@ -9,7 +9,10 @@ import { import {hasEveryAccess} from 'sentry/components/acl/access'; import Alert from 'sentry/components/alert'; import {Button} from 'sentry/components/button'; -import {PROVIDER_OPTION_TO_URLS} from 'sentry/components/events/featureFlags/utils'; +import { + PROVIDER_OPTION_TO_URLS, + ProviderOptions, +} from 'sentry/components/events/featureFlags/utils'; import Input from 'sentry/components/input'; import ExternalLink from 'sentry/components/links/externalLink'; import TextCopyInput from 'sentry/components/textCopyInput'; @@ -114,9 +117,13 @@ export default function OnboardingIntegrationSection({
- {t( - "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." - )} + {provider === ProviderOptions.UNLEASH + ? t( + `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.` + ) + : t( + "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." + )}
{t('Secret')} diff --git a/static/app/components/events/featureFlags/utils.tsx b/static/app/components/events/featureFlags/utils.tsx index 236da70c2e082f..92a7051f3fa4a7 100644 --- a/static/app/components/events/featureFlags/utils.tsx +++ b/static/app/components/events/featureFlags/utils.tsx @@ -116,16 +116,19 @@ export const sortedFlags = ({ export enum ProviderOptions { LAUNCHDARKLY = 'LaunchDarkly', GENERIC = 'Generic', + UNLEASH = 'Unleash', } export enum IntegrationOptions { LAUNCHDARKLY = 'LaunchDarkly', OPENFEATURE = 'OpenFeature', GENERIC = 'Generic', + UNLEASH = 'Unleash', } -export const PROVIDER_OPTION_TO_URLS: Record = { +export const PROVIDER_OPTION_TO_URLS: Record = { [ProviderOptions.LAUNCHDARKLY]: 'https://app.launchdarkly.com/settings/integrations/webhooks/new?q=Webhooks', [ProviderOptions.GENERIC]: 'DOCS LINK TODO', + [ProviderOptions.UNLEASH]: 'DOCS LINK TODO', }; diff --git a/static/app/gettingStartedDocs/javascript/javascript.tsx b/static/app/gettingStartedDocs/javascript/javascript.tsx index f6cfdbb84e63ca..6485b94b885c01 100644 --- a/static/app/gettingStartedDocs/javascript/javascript.tsx +++ b/static/app/gettingStartedDocs/javascript/javascript.tsx @@ -93,6 +93,11 @@ client.addHooks(new Sentry.OpenFeatureIntegrationHook()); // Evaluating flags will record the result on the Sentry client. const result = client.getBooleanValue('my-flag', false);`, }, + [IntegrationOptions.UNLEASH]: { + importStatement: `TODO`, + integration: 'TODO', + sdkInit: `TODO`, + }, [IntegrationOptions.GENERIC]: { importStatement: ``, integration: 'featureFlagsIntegration()', diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index a8665c95939a9f..4554b32bd6d10e 100644 --- a/static/app/gettingStartedDocs/python/python.tsx +++ b/static/app/gettingStartedDocs/python/python.tsx @@ -31,6 +31,10 @@ const FLAG_OPTION_TO_IMPORT: Record = { module: 'openfeature', integration: 'OpenFeatureIntegration', }, + [IntegrationOptions.UNLEASH]: { + module: 'unleash', + integration: 'UnleashIntegration', + }, [IntegrationOptions.GENERIC]: { module: 'featureflags', integration: 'FeatureFlagsIntegration', @@ -263,13 +267,34 @@ export const featureFlagOnboarding: OnboardingConfig = { code: ` import sentry-sdk from sentry_sdk.integrations.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration} +${ + featureFlagOptions.integration === IntegrationOptions.UNLEASH + ? `from UnleashClient import UnleashClient + +unleash_client = UnleashClient( + url="/api/", # "http://localhost:4242/api/" if you are self-hosting Unleash. + app_name="my-app", # Identifies your app in the Unleash UI. + custom_headers={ + # See https://docs.getunleash.io/how-to/how-to-create-api-tokens + "Authorization": os.environ["UNLEASH_CLIENT_API_TOKEN"] + } +) + +unleash_integration = UnleashIntegration(unleash_client) +sentry_sdk.init( + dsn="${dsn.public}", + integrations=[unleash_integration], +)` + : ` sentry_sdk.init( dsn="${dsn.public}", integrations=[ ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}(), ] -)`, +)` +} +`, }, ], }, diff --git a/static/app/views/settings/featureFlags/newProviderForm.tsx b/static/app/views/settings/featureFlags/newProviderForm.tsx index 33b68ed65bef65..0eb7b3723ce072 100644 --- a/static/app/views/settings/featureFlags/newProviderForm.tsx +++ b/static/app/views/settings/featureFlags/newProviderForm.tsx @@ -118,6 +118,7 @@ export default function NewProviderForm({ name="provider" options={[ {value: 'LaunchDarkly', label: 'LaunchDarkly'}, + {value: 'Unleash', label: 'Unleash'}, {value: 'Generic', label: 'Custom'}, ]} help={t( From 698731bac9d4d54481d93c873b077f9a35ac0b35 Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:18:10 -0800 Subject: [PATCH 05/10] :recycle: update unleash python --- .../app/gettingStartedDocs/python/python.tsx | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index 4554b32bd6d10e..66252823756b01 100644 --- a/static/app/gettingStartedDocs/python/python.tsx +++ b/static/app/gettingStartedDocs/python/python.tsx @@ -267,33 +267,13 @@ export const featureFlagOnboarding: OnboardingConfig = { code: ` import sentry-sdk from sentry_sdk.integrations.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration} -${ - featureFlagOptions.integration === IntegrationOptions.UNLEASH - ? `from UnleashClient import UnleashClient - -unleash_client = UnleashClient( - url="/api/", # "http://localhost:4242/api/" if you are self-hosting Unleash. - app_name="my-app", # Identifies your app in the Unleash UI. - custom_headers={ - # See https://docs.getunleash.io/how-to/how-to-create-api-tokens - "Authorization": os.environ["UNLEASH_CLIENT_API_TOKEN"] - } -) - -unleash_integration = UnleashIntegration(unleash_client) -sentry_sdk.init( - dsn="${dsn.public}", - integrations=[unleash_integration], -)` - : ` sentry_sdk.init( dsn="${dsn.public}", integrations=[ ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}(), ] -)` -} +) `, }, ], From 3c4676a5b27c4a4a88293867dcaa14ab26ad9aa3 Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:12:56 -0800 Subject: [PATCH 06/10] :recycle revert change --- .../featureFlags/featureFlagOnboardingSidebar.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx b/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx index 46b821bbb3ed46..155c8bdd6153d5 100644 --- a/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx +++ b/static/app/components/events/featureFlags/featureFlagOnboardingSidebar.tsx @@ -165,12 +165,7 @@ function OnboardingContent({ return { value: provider, textValue: provider, - label: - provider === ProviderOptions.GENERIC ? ( - {t('Custom')} - ) : ( - {provider} - ), + label: {provider}, }; }); @@ -185,12 +180,7 @@ function OnboardingContent({ return { value: provider, textValue: provider, - label: - provider === ProviderOptions.GENERIC ? ( - {t('Custom')} - ) : ( - {provider} - ), + label: {provider}, }; }); From 9629bc5313244052a26326c0c050b401a10efa3c Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Tue, 14 Jan 2025 10:20:02 -0800 Subject: [PATCH 07/10] :sparkles: add unleash js --- .../javascript/javascript.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/static/app/gettingStartedDocs/javascript/javascript.tsx b/static/app/gettingStartedDocs/javascript/javascript.tsx index 6485b94b885c01..95a25842d6e2ab 100644 --- a/static/app/gettingStartedDocs/javascript/javascript.tsx +++ b/static/app/gettingStartedDocs/javascript/javascript.tsx @@ -94,9 +94,20 @@ client.addHooks(new Sentry.OpenFeatureIntegrationHook()); const result = client.getBooleanValue('my-flag', false);`, }, [IntegrationOptions.UNLEASH]: { - importStatement: `TODO`, - integration: 'TODO', - sdkInit: `TODO`, + importStatement: `import { UnleashClient } from 'unleash-proxy-client';`, + integration: 'unleashIntegration(UnleashClient)', + sdkInit: `const unleash = new UnleashClient({ + url: "https:///api/frontend", + clientKey: "", + appName: "my-webapp", +}); + +unleash.start(); + +// Evaluate a flag with a default value. You may have to wait for your client to synchronize first. +unleash.isEnabled("test-flag"); + +Sentry.captureException(new Error("Something went wrong!"));`, }, [IntegrationOptions.GENERIC]: { importStatement: ``, From 922a892ef770dbd46fb9e139b4c06286acdaae4c Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:59:40 -0800 Subject: [PATCH 08/10] :recycle: fix python generic onboarding --- .../app/gettingStartedDocs/python/python.tsx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index 18b210815e2eb0..16f2393bfc3e21 100644 --- a/static/app/gettingStartedDocs/python/python.tsx +++ b/static/app/gettingStartedDocs/python/python.tsx @@ -37,7 +37,7 @@ const FLAG_OPTION_TO_IMPORT: Record = { }, [IntegrationOptions.GENERIC]: { module: 'feature_flags', - integration: 'FeatureFlagsIntegration', + integration: '', }, }; @@ -256,16 +256,21 @@ export const featureFlagOnboarding: OnboardingConfig = { configure: ({featureFlagOptions = {integration: ''}, dsn}) => [ { type: StepType.CONFIGURE, - description: tct('Add [name] to your integrations list.', { - name: ( - {`${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}()`} - ), - }), + description: + featureFlagOptions.integration === IntegrationOptions.GENERIC + ? `This provider doesn't require any changes to your configuration or integrations list. Simply import and use the API function:` + : tct('Add [name] to your integrations list.', { + name: ( + {`${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}()`} + ), + }), configurations: [ { language: 'python', - code: ` -import sentry-sdk + code: + featureFlagOptions.integration === IntegrationOptions.GENERIC + ? `from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import add_feature_flag` + : `import sentry-sdk from sentry_sdk.integrations.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration} sentry_sdk.init( @@ -273,8 +278,7 @@ sentry_sdk.init( integrations=[ ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}(), ] -) -`, +)`, }, ], }, From 1f0f8376f30e0479f47ff982df9d33a28f12535e Mon Sep 17 00:00:00 2001 From: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> Date: Tue, 14 Jan 2025 12:08:43 -0800 Subject: [PATCH 09/10] :art: add back init --- static/app/gettingStartedDocs/python/python.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index 16f2393bfc3e21..1c1417c27d3d36 100644 --- a/static/app/gettingStartedDocs/python/python.tsx +++ b/static/app/gettingStartedDocs/python/python.tsx @@ -269,7 +269,14 @@ export const featureFlagOnboarding: OnboardingConfig = { language: 'python', code: featureFlagOptions.integration === IntegrationOptions.GENERIC - ? `from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import add_feature_flag` + ? `from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import add_feature_flag + +sentry_sdk.init( + dsn="${dsn.public}", + integrations=[ + # your other integrations here + ] +)` : `import sentry-sdk from sentry_sdk.integrations.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration} From c2bd9126c08acfc8af64cdb80eed7ea811b07e4d Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:16:07 -0800 Subject: [PATCH 10/10] Update python desc and module prop --- static/app/gettingStartedDocs/python/python.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx index 1c1417c27d3d36..a364b0a69eaf2d 100644 --- a/static/app/gettingStartedDocs/python/python.tsx +++ b/static/app/gettingStartedDocs/python/python.tsx @@ -24,15 +24,15 @@ type FlagImports = { const FLAG_OPTION_TO_IMPORT: Record = { [IntegrationOptions.LAUNCHDARKLY]: { - module: 'launchdarkly', + module: 'integrations.launchdarkly', integration: 'LaunchDarklyIntegration', }, [IntegrationOptions.OPENFEATURE]: { - module: 'openfeature', + module: 'integrations.openfeature', integration: 'OpenFeatureIntegration', }, [IntegrationOptions.UNLEASH]: { - module: 'unleash', + module: 'integrations.unleash', integration: 'UnleashIntegration', }, [IntegrationOptions.GENERIC]: { @@ -188,7 +188,7 @@ export const performanceOnboarding: OnboardingConfig = { ), language: 'python', code: ` -import sentry-sdk +import sentry_sdk sentry_sdk.init( dsn="${params.dsn.public}", @@ -258,7 +258,7 @@ export const featureFlagOnboarding: OnboardingConfig = { type: StepType.CONFIGURE, description: featureFlagOptions.integration === IntegrationOptions.GENERIC - ? `This provider doesn't require any changes to your configuration or integrations list. Simply import and use the API function:` + ? `This provider doesn't use an integration. Simply initialize Sentry and import the API.` : tct('Add [name] to your integrations list.', { name: ( {`${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration}()`} @@ -269,7 +269,8 @@ export const featureFlagOnboarding: OnboardingConfig = { language: 'python', code: featureFlagOptions.integration === IntegrationOptions.GENERIC - ? `from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import add_feature_flag + ? `import sentry_sdk +from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import add_feature_flag sentry_sdk.init( dsn="${dsn.public}", @@ -277,8 +278,8 @@ sentry_sdk.init( # your other integrations here ] )` - : `import sentry-sdk -from sentry_sdk.integrations.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration} + : `import sentry_sdk +from sentry_sdk.${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].module} import ${FLAG_OPTION_TO_IMPORT[featureFlagOptions.integration].integration} sentry_sdk.init( dsn="${dsn.public}",