123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
- import type {
- Docs,
- DocsParams,
- OnboardingConfig,
- } from 'sentry/components/onboarding/gettingStartedDoc/types';
- import {
- getCrashReportBackendInstallStep,
- getCrashReportModalConfigDescription,
- getCrashReportModalIntroduction,
- } from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
- 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',
- },
- ],
- },
- ],
- };
- export const crashReportOnboardingPython: OnboardingConfig = {
- introduction: () => getCrashReportModalIntroduction(),
- install: (params: Params) => getCrashReportBackendInstallStep(params),
- configure: () => [
- {
- type: StepType.CONFIGURE,
- description: getCrashReportModalConfigDescription({
- link: 'https://docs.sentry.io/platforms/python/user-feedback/configuration/#crash-report-modal',
- }),
- },
- ],
- verify: () => [],
- nextSteps: () => [],
- };
- const docs: Docs = {
- onboarding,
- customMetricsOnboarding: getPythonMetricsOnboarding({
- installSnippet: getInstallSnippet(),
- }),
- crashReportOnboarding: crashReportOnboardingPython,
- };
- export default docs;
|