falcon.tsx 1.9 KB

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