rack.tsx 1.6 KB

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