rack.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 [sentryRackCode:Sentry::Rack::CaptureExceptions] to your [sentryConfigCode:config.ru] or other rackup file (this is automatically inserted in Rails):',
  33. {
  34. sentryRackCode: <code />,
  35. sentryConfigCode: <code />,
  36. }
  37. )}
  38. </p>
  39. ),
  40. configurations: [
  41. {
  42. language: 'ruby',
  43. code: `
  44. require 'sentry-ruby'
  45. Sentry.init do |config|
  46. config.dsn = '${dsn}'
  47. # Set traces_sample_rate to 1.0 to capture 100%
  48. # of transactions for performance monitoring.
  49. # We recommend adjusting this value in production.
  50. config.traces_sample_rate = 1.0
  51. # or
  52. config.traces_sampler = lambda do |context|
  53. true
  54. end
  55. end
  56. use Sentry::Rack::CaptureExceptions
  57. `,
  58. },
  59. ],
  60. },
  61. ];
  62. // Configuration End
  63. export function GettingStartedWithRubyRack({dsn, ...props}: ModuleProps) {
  64. return <Layout steps={steps({dsn})} {...props} />;
  65. }
  66. export default GettingStartedWithRubyRack;