chalice.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
  2. import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
  3. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  4. import {tct} from 'sentry/locale';
  5. // Configuration Start
  6. export const steps = ({
  7. dsn,
  8. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  9. {
  10. type: StepType.INSTALL,
  11. description: (
  12. <p>
  13. {tct('Install [code:sentry-sdk] from PyPI:', {
  14. code: <code />,
  15. })}
  16. </p>
  17. ),
  18. configurations: [
  19. {
  20. language: 'bash',
  21. code: 'pip install --upgrade sentry-sdk[chalice]',
  22. },
  23. ],
  24. },
  25. {
  26. type: StepType.CONFIGURE,
  27. configurations: [
  28. {
  29. language: 'python',
  30. code: `
  31. import sentry_sdk
  32. from chalice import Chalice
  33. from sentry_sdk.integrations.chalice import ChaliceIntegration
  34. sentry_sdk.init(
  35. dsn="${dsn}",
  36. integrations=[
  37. ChaliceIntegration(),
  38. ],
  39. # Set traces_sample_rate to 1.0 to capture 100%
  40. # of transactions for performance monitoring.
  41. # We recommend adjusting this value in production,
  42. traces_sample_rate=1.0,
  43. )
  44. app = Chalice(app_name="appname")
  45. `,
  46. },
  47. ],
  48. },
  49. ];
  50. // Configuration End
  51. export function GettingStartedWithChalice({dsn, ...props}: ModuleProps) {
  52. return <Layout steps={steps({dsn})} {...props} />;
  53. }
  54. export default GettingStartedWithChalice;