celery.tsx 2.1 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. <p>
  10. {tct('The celery integration adds support for the [link:Celery Task Queue System].', {
  11. link: <ExternalLink href="https://docs.celeryq.dev/en/stable/" />,
  12. })}
  13. </p>
  14. );
  15. export const steps = ({
  16. dsn,
  17. }: {
  18. dsn?: string;
  19. } = {}): LayoutProps['steps'] => [
  20. {
  21. type: StepType.CONFIGURE,
  22. description: (
  23. <p>
  24. {tct(
  25. 'Just add [celeryIntegrationCode:CeleryIntegration()] to your [integrationsCode:integrations] list:',
  26. {
  27. celeryIntegrationCode: <code />,
  28. integrationsCode: <code />,
  29. }
  30. )}
  31. </p>
  32. ),
  33. configurations: [
  34. {
  35. language: 'python',
  36. code: `
  37. import sentry_sdk
  38. from sentry_sdk.integrations.celery import CeleryIntegration
  39. sentry_sdk.init(
  40. dsn='${dsn}',
  41. integrations=[
  42. CeleryIntegration(),
  43. ],
  44. # Set traces_sample_rate to 1.0 to capture 100%
  45. # of transactions for performance monitoring.
  46. # We recommend adjusting this value in production,
  47. traces_sample_rate=1.0,
  48. )
  49. `,
  50. },
  51. ],
  52. additionalInfo: (
  53. <Fragment>
  54. {t(
  55. 'Additionally, the Sentry Python SDK will set the transaction on the event to the task name, and it will improve the grouping for global Celery errors such as timeouts.'
  56. )}
  57. <p>
  58. {t('The integration will automatically report errors from all celery jobs.')}
  59. </p>
  60. </Fragment>
  61. ),
  62. },
  63. ];
  64. // Configuration End
  65. export function GettingStartedWithCelery({dsn, ...props}: ModuleProps) {
  66. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  67. }
  68. export default GettingStartedWithCelery;