falcon.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import ExternalLink from 'sentry/components/links/externalLink';
  2. import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
  3. import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
  4. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  5. import {t, tct} from 'sentry/locale';
  6. // Configuration Start
  7. const introduction = (
  8. <p>
  9. {tct(
  10. 'The Falcon integration adds support for the [link:Falcon Web Framework]. The integration has been confirmed to work with Falcon 1.4 and 2.0.',
  11. {
  12. link: <ExternalLink href="https://falconframework.org/" />,
  13. }
  14. )}
  15. </p>
  16. );
  17. export const steps = ({
  18. dsn,
  19. }: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
  20. {
  21. type: StepType.INSTALL,
  22. description: (
  23. <p>
  24. {tct(
  25. 'Install [sentrySdkCode:sentry-sdk] from PyPI with the [sentryFalconCode:falcon] extra:',
  26. {
  27. sentrySdkCode: <code />,
  28. sentryFalconCode: <code />,
  29. }
  30. )}
  31. </p>
  32. ),
  33. configurations: [
  34. {
  35. language: 'bash',
  36. code: "$ pip install --upgrade 'sentry-sdk[falcon]'",
  37. },
  38. ],
  39. },
  40. {
  41. type: StepType.CONFIGURE,
  42. description: t(
  43. 'To configure the SDK, initialize it with the integration before your app has been initialized:'
  44. ),
  45. configurations: [
  46. {
  47. language: 'python',
  48. code: `
  49. import falcon
  50. import sentry_sdk
  51. from sentry_sdk.integrations.falcon import FalconIntegration
  52. sentry_sdk.init(
  53. dsn="${dsn}",
  54. integrations=[
  55. FalconIntegration(),
  56. ],
  57. # Set traces_sample_rate to 1.0 to capture 100%
  58. # of transactions for performance monitoring.
  59. # We recommend adjusting this value in production,
  60. traces_sample_rate=1.0,
  61. )
  62. api = falcon.API()
  63. `,
  64. },
  65. ],
  66. },
  67. ];
  68. // Configuration End
  69. export function GettingStartedWithFalcon({dsn, ...props}: ModuleProps) {
  70. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  71. }
  72. export default GettingStartedWithFalcon;