rq.tsx 1.7 KB

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