falcon.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. }: {
  20. dsn?: string;
  21. } = {}): LayoutProps['steps'] => [
  22. {
  23. type: StepType.INSTALL,
  24. description: (
  25. <p>
  26. {tct(
  27. 'Install [sentrySdkCode:sentry-sdk] from PyPI with the [sentryFalconCode:falcon] extra:',
  28. {
  29. sentrySdkCode: <code />,
  30. sentryFalconCode: <code />,
  31. }
  32. )}
  33. </p>
  34. ),
  35. configurations: [
  36. {
  37. language: 'bash',
  38. code: "$ pip install --upgrade 'sentry-sdk[falcon]'",
  39. },
  40. ],
  41. },
  42. {
  43. type: StepType.CONFIGURE,
  44. description: t(
  45. 'To configure the SDK, initialize it with the integration before your app has been initialized:'
  46. ),
  47. configurations: [
  48. {
  49. language: 'python',
  50. code: `
  51. import falcon
  52. import sentry_sdk
  53. from sentry_sdk.integrations.falcon import FalconIntegration
  54. sentry_sdk.init(
  55. dsn="${dsn}",
  56. integrations=[
  57. FalconIntegration(),
  58. ],
  59. # Set traces_sample_rate to 1.0 to capture 100%
  60. # of transactions for performance monitoring.
  61. # We recommend adjusting this value in production,
  62. traces_sample_rate=1.0,
  63. )
  64. api = falcon.API()
  65. `,
  66. },
  67. ],
  68. },
  69. ];
  70. // Configuration End
  71. export function GettingStartedWithFalcon({dsn, ...props}: ModuleProps) {
  72. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  73. }
  74. export default GettingStartedWithFalcon;