tornado.tsx 2.1 KB

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