|
| 1 | +import {Fragment} from 'react'; |
| 2 | + |
| 3 | +import ExternalLink from 'sentry/components/links/externalLink'; |
| 4 | +import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; |
| 5 | +import { |
| 6 | + Docs, |
| 7 | + DocsParams, |
| 8 | + OnboardingConfig, |
| 9 | +} from 'sentry/components/onboarding/gettingStartedDoc/types'; |
| 10 | +import {t, tct} from 'sentry/locale'; |
| 11 | + |
| 12 | +type Params = DocsParams; |
| 13 | + |
| 14 | +const getSdkSetupSnippet = (params: Params) => ` |
| 15 | +import { defineConfig } from "astro/config"; |
| 16 | +import sentry from "@sentry/astro"; |
| 17 | +
|
| 18 | +export default defineConfig({ |
| 19 | + integrations: [ |
| 20 | + sentry({ |
| 21 | + dsn: "${params.dsn}",${ |
| 22 | + params.isPerformanceSelected |
| 23 | + ? '' |
| 24 | + : ` |
| 25 | + tracesSampleRate: 0,` |
| 26 | + }${ |
| 27 | + params.isReplaySelected |
| 28 | + ? '' |
| 29 | + : ` |
| 30 | + replaysSessionSampleRate: 0, |
| 31 | + replaysOnErrorSampleRate: 0,` |
| 32 | + } |
| 33 | + sourceMapsUploadOptions: { |
| 34 | + project: "${params.projectSlug}", |
| 35 | + authToken: process.env.SENTRY_AUTH_TOKEN, |
| 36 | + }, |
| 37 | + }), |
| 38 | + ], |
| 39 | +}); |
| 40 | +`; |
| 41 | + |
| 42 | +const getVerifyAstroSnippet = () => ` |
| 43 | +<!-- your-page.astro --> |
| 44 | +<button onclick="throw new Error('This is a test error')"> |
| 45 | + Throw test error |
| 46 | +</button> |
| 47 | +`; |
| 48 | + |
| 49 | +const onboarding: OnboardingConfig = { |
| 50 | + introduction: () => |
| 51 | + tct("Sentry's integration with [astroLink:Astro] supports Astro 3.0.0 and above.", { |
| 52 | + astroLink: <ExternalLink href="https://astro.build/" />, |
| 53 | + }), |
| 54 | + install: (_params: Params) => [ |
| 55 | + { |
| 56 | + type: StepType.INSTALL, |
| 57 | + configurations: [ |
| 58 | + { |
| 59 | + description: tct( |
| 60 | + 'Install the [sentryAstroPkg:@sentry/astro] package with the [astroCli:astro] CLI:', |
| 61 | + { |
| 62 | + sentryAstroPkg: <code />, |
| 63 | + astroCli: <code />, |
| 64 | + } |
| 65 | + ), |
| 66 | + language: 'bash', |
| 67 | + code: [ |
| 68 | + { |
| 69 | + label: 'bash', |
| 70 | + value: 'bash', |
| 71 | + language: 'bash', |
| 72 | + code: `npx astro add @sentry/astro`, |
| 73 | + }, |
| 74 | + ], |
| 75 | + }, |
| 76 | + ], |
| 77 | + }, |
| 78 | + ], |
| 79 | + configure: (params: Params) => [ |
| 80 | + { |
| 81 | + type: StepType.CONFIGURE, |
| 82 | + description: tct( |
| 83 | + 'Open up your [astroConfig:astro.config.mjs] file and configure the DSN, and any other settings you need:', |
| 84 | + { |
| 85 | + astroConfig: <code />, |
| 86 | + } |
| 87 | + ), |
| 88 | + configurations: [ |
| 89 | + { |
| 90 | + code: [ |
| 91 | + { |
| 92 | + label: 'JavaScript', |
| 93 | + value: 'javascript', |
| 94 | + language: 'javascript', |
| 95 | + code: getSdkSetupSnippet(params), |
| 96 | + }, |
| 97 | + ], |
| 98 | + }, |
| 99 | + { |
| 100 | + description: tct( |
| 101 | + 'Add your Sentry auth token to the [authTokenEnvVar:SENTRY_AUTH_TOKEN] environment variable:', |
| 102 | + { |
| 103 | + authTokenEnvVar: <code />, |
| 104 | + } |
| 105 | + ), |
| 106 | + language: 'bash', |
| 107 | + code: [ |
| 108 | + { |
| 109 | + value: 'bash', |
| 110 | + language: 'bash', |
| 111 | + label: 'bash', |
| 112 | + code: `SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___`, |
| 113 | + }, |
| 114 | + ], |
| 115 | + }, |
| 116 | + { |
| 117 | + description: tct( |
| 118 | + 'You can further customize your SDK by [manualSetupLink:manually inializing the SDK].', |
| 119 | + { |
| 120 | + manualSetupLink: ( |
| 121 | + <ExternalLink href="https://docs.sentry.io/platforms/javascript/guides/astro/manual-setup/" /> |
| 122 | + ), |
| 123 | + } |
| 124 | + ), |
| 125 | + }, |
| 126 | + ], |
| 127 | + }, |
| 128 | + ], |
| 129 | + verify: () => [ |
| 130 | + { |
| 131 | + type: StepType.VERIFY, |
| 132 | + description: t( |
| 133 | + 'Then throw a test error anywhere in your app, so you can test that everything is working:' |
| 134 | + ), |
| 135 | + configurations: [ |
| 136 | + { |
| 137 | + code: [ |
| 138 | + { |
| 139 | + label: 'Astro', |
| 140 | + value: 'html', |
| 141 | + language: 'html', |
| 142 | + code: getVerifyAstroSnippet(), |
| 143 | + }, |
| 144 | + ], |
| 145 | + }, |
| 146 | + ], |
| 147 | + additionalInfo: ( |
| 148 | + <Fragment> |
| 149 | + <p> |
| 150 | + {t( |
| 151 | + "If you're new to Sentry, use the email alert to access your account and complete a product tour." |
| 152 | + )} |
| 153 | + </p> |
| 154 | + <p> |
| 155 | + {t( |
| 156 | + "If you're an existing user and have disabled alerts, you won't receive this email." |
| 157 | + )} |
| 158 | + </p> |
| 159 | + </Fragment> |
| 160 | + ), |
| 161 | + }, |
| 162 | + ], |
| 163 | + nextSteps: () => [ |
| 164 | + { |
| 165 | + id: 'astro-manual-setup', |
| 166 | + name: t('Customize your SDK Setup'), |
| 167 | + description: t( |
| 168 | + 'Learn how to further configure and customize your Sentry Astro SDK setup.' |
| 169 | + ), |
| 170 | + link: 'https://docs.sentry.io/platforms/javascript/guides/astro/manual-setup/', |
| 171 | + }, |
| 172 | + { |
| 173 | + id: 'performance-monitoring', |
| 174 | + name: t('Performance Monitoring'), |
| 175 | + description: t( |
| 176 | + 'Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.' |
| 177 | + ), |
| 178 | + link: 'https://docs.sentry.io/platforms/javascript/guides/astro/performance/', |
| 179 | + }, |
| 180 | + { |
| 181 | + id: 'session-replay', |
| 182 | + name: t('Session Replay'), |
| 183 | + description: t( |
| 184 | + 'Get to the root cause of an error or latency issue faster by seeing all the technical details related to that issue in one visual replay on your web application.' |
| 185 | + ), |
| 186 | + link: 'https://docs.sentry.io/platforms/javascript/guides/astro/session-replay/', |
| 187 | + }, |
| 188 | + ], |
| 189 | +}; |
| 190 | + |
| 191 | +const docs: Docs = { |
| 192 | + onboarding, |
| 193 | +}; |
| 194 | + |
| 195 | +export default docs; |
0 commit comments