mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
92 lines
2.2 KiB
TypeScript
92 lines
2.2 KiB
TypeScript
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;
|