rack.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 {CrashReportWebApiOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
  8. import {tct} from 'sentry/locale';
  9. type Params = DocsParams;
  10. const getConfigureSnippet = (params: Params) => `
  11. require 'sentry-ruby'
  12. Sentry.init do |config|
  13. config.dsn = '${params.dsn}'
  14. # Set traces_sample_rate to 1.0 to capture 100%
  15. # of transactions for performance monitoring.
  16. # We recommend adjusting this value in production.
  17. config.traces_sample_rate = 1.0
  18. # or
  19. config.traces_sampler = lambda do |context|
  20. true
  21. end
  22. end
  23. use Sentry::Rack::CaptureExceptions`;
  24. const onboarding: OnboardingConfig = {
  25. install: () => [
  26. {
  27. type: StepType.INSTALL,
  28. description: tct(
  29. 'Install the SDK via Rubygems by adding it to your [code:Gemfile]:',
  30. {
  31. code: <code />,
  32. }
  33. ),
  34. configurations: [
  35. {
  36. language: 'ruby',
  37. code: `gem "sentry-ruby"`,
  38. },
  39. ],
  40. },
  41. ],
  42. configure: params => [
  43. {
  44. type: StepType.CONFIGURE,
  45. description: tct(
  46. 'Add use [sentryRackCode:Sentry::Rack::CaptureExceptions] to your [sentryConfigCode:config.ru] or other rackup file (this is automatically inserted in Rails):',
  47. {
  48. sentryRackCode: <code />,
  49. sentryConfigCode: <code />,
  50. }
  51. ),
  52. configurations: [
  53. {
  54. language: 'ruby',
  55. code: getConfigureSnippet(params),
  56. },
  57. ],
  58. },
  59. ],
  60. verify: () => [],
  61. };
  62. const docs: Docs = {
  63. onboarding,
  64. crashReportOnboarding: CrashReportWebApiOnboarding,
  65. };
  66. export default docs;