rails.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  2. import type {
  3. Docs,
  4. DocsParams,
  5. OnboardingConfig,
  6. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  7. import replayOnboardingJsLoader from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
  8. import {t, tct} from 'sentry/locale';
  9. type Params = DocsParams;
  10. const onboarding: OnboardingConfig = {
  11. introduction: () =>
  12. t(
  13. 'In Rails, all uncaught exceptions will be automatically reported. We support Rails 5 and newer.'
  14. ),
  15. install: () => [
  16. {
  17. type: StepType.INSTALL,
  18. description: tct(
  19. 'Add [sentryRubyCode:sentry-ruby] and [sentryRailsCode:sentry-rails] to your [sentryGemfileCode:Gemfile]:',
  20. {
  21. sentryRubyCode: <code />,
  22. sentryRailsCode: <code />,
  23. sentryGemfileCode: <code />,
  24. }
  25. ),
  26. configurations: [
  27. {
  28. language: 'ruby',
  29. code: `
  30. gem "sentry-ruby"
  31. gem "sentry-rails"
  32. `,
  33. },
  34. ],
  35. },
  36. ],
  37. configure: (params: Params) => [
  38. {
  39. type: StepType.CONFIGURE,
  40. description: tct(
  41. 'Initialize the SDK within your [code:config/initializers/sentry.rb]:',
  42. {
  43. code: <code />,
  44. }
  45. ),
  46. configurations: [
  47. {
  48. language: 'ruby',
  49. code: `
  50. Sentry.init do |config|
  51. config.dsn = '${params.dsn}'
  52. config.breadcrumbs_logger = [:active_support_logger, :http_logger]
  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. config.traces_sample_rate = 1.0
  57. # or
  58. config.traces_sampler = lambda do |context|
  59. true
  60. end
  61. end
  62. `,
  63. },
  64. ],
  65. },
  66. {
  67. title: t('Caveats'),
  68. description: (
  69. <p>
  70. {tct(
  71. 'Currently, custom exception applications [code:(config.exceptions_app)] are not supported. If you are using a custom exception app, you must manually integrate Sentry yourself.',
  72. {
  73. code: <code />,
  74. }
  75. )}
  76. </p>
  77. ),
  78. },
  79. ],
  80. verify: () => [],
  81. nextSteps: () => [],
  82. };
  83. const docs: Docs = {
  84. onboarding,
  85. replayOnboardingJsLoader,
  86. };
  87. export default docs;