tornado.tsx 2.2 KB

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