celery.tsx 2.1 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. <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. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  18. {
  19. type: StepType.CONFIGURE,
  20. description: (
  21. <p>
  22. {tct(
  23. 'Just add [celeryIntegrationCode:CeleryIntegration()] to your [integrationsCode:integrations] list:',
  24. {
  25. celeryIntegrationCode: <code />,
  26. integrationsCode: <code />,
  27. }
  28. )}
  29. </p>
  30. ),
  31. configurations: [
  32. {
  33. language: 'python',
  34. code: `
  35. import sentry_sdk
  36. from sentry_sdk.integrations.celery import CeleryIntegration
  37. sentry_sdk.init(
  38. dsn='${dsn}',
  39. integrations=[
  40. CeleryIntegration(),
  41. ],
  42. # Set traces_sample_rate to 1.0 to capture 100%
  43. # of transactions for performance monitoring.
  44. # We recommend adjusting this value in production,
  45. traces_sample_rate=1.0,
  46. )
  47. `,
  48. },
  49. ],
  50. additionalInfo: (
  51. <Fragment>
  52. {t(
  53. '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.'
  54. )}
  55. <p>
  56. {t('The integration will automatically report errors from all celery jobs.')}
  57. </p>
  58. </Fragment>
  59. ),
  60. },
  61. ];
  62. // Configuration End
  63. export function GettingStartedWithCelery({dsn, ...props}: ModuleProps) {
  64. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  65. }
  66. export default GettingStartedWithCelery;