rails.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 getInstallSnippet = () => `
  11. gem "sentry-ruby"
  12. gem "sentry-rails"`;
  13. const getConfigureSnippet = (params: Params) => `
  14. Sentry.init do |config|
  15. config.dsn = '${params.dsn}'
  16. config.breadcrumbs_logger = [:active_support_logger, :http_logger]
  17. # Set traces_sample_rate to 1.0 to capture 100%
  18. # of transactions for performance monitoring.
  19. # We recommend adjusting this value in production.
  20. config.traces_sample_rate = 1.0
  21. # or
  22. config.traces_sampler = lambda do |context|
  23. true
  24. end
  25. end`;
  26. const onboarding: OnboardingConfig = {
  27. introduction: () =>
  28. t(
  29. 'In Rails, all uncaught exceptions will be automatically reported. We support Rails 5 and newer.'
  30. ),
  31. install: () => [
  32. {
  33. type: StepType.INSTALL,
  34. description: tct(
  35. 'Add [sentryRubyCode:sentry-ruby] and [sentryRailsCode:sentry-rails] to your [sentryGemfileCode:Gemfile]:',
  36. {
  37. sentryRubyCode: <code />,
  38. sentryRailsCode: <code />,
  39. sentryGemfileCode: <code />,
  40. }
  41. ),
  42. configurations: [
  43. {
  44. language: 'ruby',
  45. code: getInstallSnippet(),
  46. },
  47. ],
  48. },
  49. ],
  50. configure: (params: Params) => [
  51. {
  52. type: StepType.CONFIGURE,
  53. description: tct(
  54. 'Initialize the SDK within your [code:config/initializers/sentry.rb]:',
  55. {
  56. code: <code />,
  57. }
  58. ),
  59. configurations: [
  60. {
  61. language: 'ruby',
  62. code: getConfigureSnippet(params),
  63. },
  64. ],
  65. },
  66. {
  67. title: t('Caveats'),
  68. description: tct(
  69. '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.',
  70. {
  71. code: <code />,
  72. }
  73. ),
  74. },
  75. ],
  76. verify: () => [],
  77. nextSteps: () => [],
  78. };
  79. const docs: Docs = {
  80. onboarding,
  81. replayOnboardingJsLoader,
  82. };
  83. export default docs;