bottle.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 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. }: 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 [sentryBotteCode:bottle] extra:',
  26. {
  27. sentrySdkCode: <code />,
  28. sentryBotteCode: <code />,
  29. }
  30. )}
  31. </p>
  32. ),
  33. configurations: [
  34. {
  35. language: 'bash',
  36. code: 'pip install --upgrade sentry-sdk[chalice]',
  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 sentry_sdk
  50. from bottle import Bottle, run
  51. from sentry_sdk.integrations.bottle import BottleIntegration
  52. sentry_sdk.init(
  53. dsn="${dsn}",
  54. integrations=[
  55. BottleIntegration(),
  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. app = Bottle()
  63. `,
  64. },
  65. ],
  66. },
  67. ];
  68. // Configuration End
  69. export function GettingStartedWithBottle({dsn, ...props}: ModuleProps) {
  70. return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
  71. }
  72. export default GettingStartedWithBottle;