rack.tsx 1.7 KB

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