rack.tsx 1.7 KB

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