import styled from '@emotion/styled'; import Alert from 'sentry/components/alert'; import ExternalLink from 'sentry/components/links/externalLink'; 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 {crashReportOnboardingPython} from 'sentry/gettingStartedDocs/python/python'; import {t, tct} from 'sentry/locale'; import {space} from 'sentry/styles/space'; type Params = DocsParams; const getInstallSnippet = () => `pip install --upgrade sentry-sdk`; const getSdkSetupSnippet = (params: Params) => ` import sentry_sdk from sentry_sdk.integrations.gcp import GcpIntegration sentry_sdk.init( dsn="${params.dsn}", integrations=[GcpIntegration()],${ 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,` : '' } ) def http_function_entrypoint(request): ...`; const getTimeoutWarningSnippet = (params: Params) => ` sentry_sdk.init( dsn="${params.dsn}", integrations=[ GcpIntegration(timeout_warning=True), ], )`; const onboarding: OnboardingConfig = { install: (params: Params) => [ { type: StepType.INSTALL, description: (
{tct('Install our Python SDK using [code:pip]:', {code: })}
,
codePackage:
,
}
)
: undefined,
language: 'bash',
code: getInstallSnippet(),
},
],
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
description: t(
'You can use the Google Cloud Functions integration for the Python SDK like this:'
),
configurations: [
{
language: 'python',
code: getSdkSetupSnippet(params),
},
],
additionalInfo: tct(
"Check out Sentry's [link:GCP sample apps] for detailed examples.",
{
link: (
, codeStatus:
}
),
language: 'python',
code: getTimeoutWarningSnippet(params),
},
{
description: t(
'The timeout warning is sent only if the timeout in the Cloud Function configuration is set to a value greater than one second.'
),
},
],
additionalInfo: (