quart.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import {Fragment} from 'react';
  2. import ExternalLink from 'sentry/components/links/externalLink';
  3. import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
  4. import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
  5. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  6. import {t, tct} from 'sentry/locale';
  7. // Configuration Start
  8. const introduction = (
  9. <Fragment>
  10. <p>
  11. {tct(
  12. 'The Quart integration adds support for the Quart Web Framework. We support Quart versions 0.16.1 and higher.',
  13. {
  14. link: <ExternalLink href="https://gitlab.com/pgjones/quart" />,
  15. }
  16. )}
  17. </p>
  18. {t('A Python version of "3.7" or higher is also required.')}
  19. </Fragment>
  20. );
  21. export const steps = ({
  22. dsn,
  23. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  24. {
  25. type: StepType.INSTALL,
  26. description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
  27. configurations: [
  28. {
  29. language: 'bash',
  30. code: '$ pip install --upgrade sentry-sdk',
  31. },
  32. ],
  33. },
  34. {
  35. type: StepType.CONFIGURE,
  36. description: t(
  37. 'To configure the SDK, initialize it with the integration before or after your app has been initialized:'
  38. ),
  39. configurations: [
  40. {
  41. language: 'python',
  42. code: `
  43. import sentry_sdk
  44. from sentry_sdk.integrations.quart import QuartIntegration
  45. from quart import Quart
  46. sentry_sdk.init(
  47. dsn="${dsn}",
  48. integrations=[
  49. QuartIntegration(),
  50. ],
  51. # Set traces_sample_rate to 1.0 to capture 100%
  52. # of transactions for performance monitoring.
  53. # We recommend adjusting this value in production,
  54. traces_sample_rate=1.0,
  55. )
  56. app = Quart(__name__)
  57. `,
  58. },
  59. ],
  60. },
  61. ];
  62. // Configuration End
  63. export function GettingStartedWithQuart({dsn, ...props}: ModuleProps) {
  64. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  65. }
  66. export default GettingStartedWithQuart;