quart.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. }: {
  24. dsn?: string;
  25. } = {}): LayoutProps['steps'] => [
  26. {
  27. type: StepType.INSTALL,
  28. description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
  29. configurations: [
  30. {
  31. language: 'bash',
  32. code: '$ pip install --upgrade sentry-sdk',
  33. },
  34. ],
  35. },
  36. {
  37. type: StepType.CONFIGURE,
  38. description: t(
  39. 'To configure the SDK, initialize it with the integration before or after your app has been initialized:'
  40. ),
  41. configurations: [
  42. {
  43. language: 'python',
  44. code: `
  45. import sentry_sdk
  46. from sentry_sdk.integrations.quart import QuartIntegration
  47. from quart import Quart
  48. sentry_sdk.init(
  49. dsn="${dsn}",
  50. integrations=[
  51. QuartIntegration(),
  52. ],
  53. # Set traces_sample_rate to 1.0 to capture 100%
  54. # of transactions for performance monitoring.
  55. # We recommend adjusting this value in production,
  56. traces_sample_rate=1.0,
  57. )
  58. app = Quart(__name__)
  59. `,
  60. },
  61. ],
  62. },
  63. ];
  64. // Configuration End
  65. export function GettingStartedWithQuart({dsn, ...props}: ModuleProps) {
  66. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  67. }
  68. export default GettingStartedWithQuart;