bottle.tsx 2.1 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 Bottle integration adds support for the Bottle Web Framework. Currently it works well with the stable version of Bottle (0.12). However the integration with the development version (0.13) doesn't work properly.",
  11. {
  12. link: <ExternalLink href="https://bottlepy.org/docs/dev/" />,
  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 [sentryBotteCode:bottle] extra:',
  28. {
  29. sentrySdkCode: <code />,
  30. sentryBotteCode: <code />,
  31. }
  32. )}
  33. </p>
  34. ),
  35. configurations: [
  36. {
  37. language: 'bash',
  38. code: 'pip install --upgrade sentry-sdk[chalice]',
  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 sentry_sdk
  52. from bottle import Bottle, run
  53. from sentry_sdk.integrations.bottle import BottleIntegration
  54. sentry_sdk.init(
  55. dsn="${dsn}",
  56. integrations=[
  57. BottleIntegration(),
  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. app = Bottle()
  65. `,
  66. },
  67. ],
  68. },
  69. ];
  70. // Configuration End
  71. export function GettingStartedWithBottle({dsn, ...props}: ModuleProps) {
  72. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  73. }
  74. export default GettingStartedWithBottle;