rq.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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('The RQ integration adds support for the [link:RQ Job Queue System].', {
  10. link: <ExternalLink href="https://python-rq.org/" />,
  11. })}
  12. </p>
  13. );
  14. export const steps = ({
  15. dsn,
  16. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  17. {
  18. type: StepType.CONFIGURE,
  19. description: (
  20. <p>
  21. {tct('Create a file called [code:mysettings.py] with the following content:', {
  22. code: <code />,
  23. })}
  24. </p>
  25. ),
  26. configurations: [
  27. {
  28. language: 'python',
  29. code: `
  30. import sentry_sdk
  31. from sentry_sdk.integrations.rq import RqIntegration
  32. sentry_sdk.init(
  33. dsn="${dsn}",
  34. integrations=[
  35. RqIntegration(),
  36. ],
  37. # Set traces_sample_rate to 1.0 to capture 100%
  38. # of transactions for performance monitoring.
  39. # We recommend adjusting this value in production,
  40. traces_sample_rate=1.0,
  41. )
  42. `,
  43. },
  44. {
  45. description: t('Start your worker with:'),
  46. language: 'shell',
  47. code: `
  48. rq worker \
  49. -c mysettings \ # module name of mysettings.py
  50. --sentry-dsn="" # only necessary for RQ < 1.0
  51. `,
  52. },
  53. ],
  54. },
  55. ];
  56. // Configuration End
  57. export function GettingStartedWithRq({dsn, ...props}: ModuleProps) {
  58. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  59. }
  60. export default GettingStartedWithRq;