chalice.tsx 1.4 KB

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