12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
- import type {
- Docs,
- DocsParams,
- OnboardingConfig,
- } from 'sentry/components/onboarding/gettingStartedDoc/types';
- import {getPythonMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
- import {t, tct} from 'sentry/locale';
- type Params = DocsParams;
- const getInstallSnippet = () => `pip install --upgrade sentry-sdk`;
- const getSdkSetupSnippet = (params: Params) => `
- import sentry_sdk
- sentry_sdk.init(
- dsn="${params.dsn}",${
- params.isPerformanceSelected
- ? `
- # Set traces_sample_rate to 1.0 to capture 100%
- # of transactions for performance monitoring.
- traces_sample_rate=1.0,`
- : ''
- }${
- params.isProfilingSelected
- ? `
- # Set profiles_sample_rate to 1.0 to profile 100%
- # of sampled transactions.
- # We recommend adjusting this value in production.
- profiles_sample_rate=1.0,`
- : ''
- }
- )`;
- const onboarding: OnboardingConfig = {
- install: () => [
- {
- type: StepType.INSTALL,
- description: tct('Install our Python SDK using [code:pip]:', {
- code: <code />,
- }),
- configurations: [
- {
- language: 'bash',
- code: getInstallSnippet(),
- },
- ],
- },
- ],
- configure: (params: Params) => [
- {
- type: StepType.CONFIGURE,
- description: t(
- "Import and initialize the Sentry SDK early in your application's setup:"
- ),
- configurations: [
- {
- language: 'python',
- code: getSdkSetupSnippet(params),
- },
- ],
- },
- ],
- verify: () => [
- {
- type: StepType.VERIFY,
- description: t(
- 'One way to verify your setup is by intentionally causing an error that breaks your application.'
- ),
- configurations: [
- {
- language: 'python',
- description: t(
- 'Raise an unhandled Python exception by inserting a divide by zero expression into your application:'
- ),
- code: 'division_by_zero = 1 / 0',
- },
- ],
- },
- ],
- };
- const docs: Docs = {
- onboarding,
- customMetricsOnboarding: getPythonMetricsOnboarding({
- installSnippet: getInstallSnippet(),
- }),
- };
- export default docs;
|