tornado.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import ExternalLink from 'sentry/components/links/externalLink';
  2. import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
  3. import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
  4. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  5. import {t, tct} from 'sentry/locale';
  6. // Configuration Start
  7. const introduction = (
  8. <p>
  9. {tct(
  10. 'The Tornado integration adds support for the [link:Tornado Web Framework]. A Tornado version of 5 or greater and Python 3.6 or greater is required.',
  11. {
  12. link: <ExternalLink href="https://www.tornadoweb.org/en/stable/" />,
  13. }
  14. )}
  15. </p>
  16. );
  17. export const steps = ({
  18. dsn,
  19. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  20. {
  21. type: StepType.INSTALL,
  22. description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
  23. configurations: [
  24. {
  25. language: 'bash',
  26. code: '$ pip install --upgrade sentry-sdk',
  27. },
  28. {
  29. description: (
  30. <p>
  31. {tct(
  32. "If you're on Python 3.6, you also need the [code:aiocontextvars] package:",
  33. {
  34. code: <code />,
  35. }
  36. )}
  37. </p>
  38. ),
  39. language: 'bash',
  40. code: '$ pip install --upgrade aiocontextvars',
  41. },
  42. ],
  43. },
  44. {
  45. type: StepType.CONFIGURE,
  46. description: t('Initialize the SDK before starting the server:'),
  47. configurations: [
  48. {
  49. language: 'python',
  50. code: `
  51. import sentry_sdk
  52. from sentry_sdk.integrations.tornado import TornadoIntegration
  53. sentry_sdk.init(
  54. dsn="${dsn}",
  55. integrations=[
  56. TornadoIntegration(),
  57. ],
  58. # Set traces_sample_rate to 1.0 to capture 100%
  59. # of transactions for performance monitoring.
  60. # We recommend adjusting this value in production,
  61. traces_sample_rate=1.0,
  62. )
  63. # Your app code here, without changes
  64. class MyHandler(...):
  65. ...
  66. `,
  67. },
  68. ],
  69. },
  70. ];
  71. // Configuration End
  72. export function GettingStartedWithTornado({dsn, ...props}: ModuleProps) {
  73. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  74. }
  75. export default GettingStartedWithTornado;