-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(onboarding): Add JS onboarding for cloudflare #103214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import {getNodeMetricsOnboarding} from 'sentry/gettingStartedDocs/node/metrics'; | ||
|
|
||
| export const metrics = getNodeMetricsOnboarding({ | ||
| docsPlatform: 'cloudflare', | ||
| packageName: '@sentry/cloudflare', | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import {getNodeMetricsOnboarding} from 'sentry/gettingStartedDocs/node/metrics'; | ||
|
|
||
| export const metrics = getNodeMetricsOnboarding({ | ||
| docsPlatform: 'cloudflare', | ||
| packageName: '@sentry/cloudflare', | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import {getNodeMetricsOnboarding} from 'sentry/gettingStartedDocs/node/utils'; | ||
| import {getNodeMetricsOnboarding} from 'sentry/gettingStartedDocs/node/metrics'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no tests for metrics? |
||
|
|
||
| export const metrics = getNodeMetricsOnboarding({ | ||
| docsPlatform: 'connect', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,106 @@ | ||
| import {getNodeMetricsOnboarding} from './utils'; | ||
| import {ExternalLink} from '@sentry/scraps/link'; | ||
|
|
||
| import type { | ||
| BasePlatformOptions, | ||
| DocsParams, | ||
| OnboardingConfig, | ||
| } from 'sentry/components/onboarding/gettingStartedDoc/types'; | ||
| import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types'; | ||
| import {getInstallCodeBlock} from 'sentry/gettingStartedDocs/node/utils'; | ||
| import {t, tct} from 'sentry/locale'; | ||
|
|
||
| export const getNodeMetricsOnboarding = < | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for creating this file and for moving the function out of utils <3 I would just name this metrics and inline this part |
||
| PlatformOptions extends BasePlatformOptions = BasePlatformOptions, | ||
| >({ | ||
| docsPlatform, | ||
| packageName, | ||
| }: { | ||
| docsPlatform: string; | ||
| packageName: `@sentry/${string}`; | ||
| }): OnboardingConfig<PlatformOptions> => ({ | ||
| install: (params: DocsParams) => [ | ||
| { | ||
| type: StepType.INSTALL, | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: tct( | ||
| 'Add the Sentry SDK as a dependency. The minimum version of [packageName] that supports metrics is [code:10.24.0].', | ||
| { | ||
| code: <code />, | ||
| packageName: <code>{packageName}</code>, | ||
| } | ||
| ), | ||
| }, | ||
| getInstallCodeBlock(params, {packageName}), | ||
| { | ||
| type: 'text', | ||
| text: tct( | ||
| 'If you are on an older version of the SDK, follow our [link:migration guide] to upgrade.', | ||
| { | ||
| link: ( | ||
| <ExternalLink | ||
| href={`https://docs.sentry.io/platforms/javascript/guides/${docsPlatform}/migration/`} | ||
| /> | ||
| ), | ||
| } | ||
| ), | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| configure: () => [ | ||
| { | ||
| type: StepType.CONFIGURE, | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: tct( | ||
| 'Metrics are automatically enabled after Sentry is initialized. You can emit metrics using the [code:Sentry.metrics] API.', | ||
| {code: <code />} | ||
| ), | ||
| }, | ||
| { | ||
| type: 'text', | ||
| text: tct( | ||
| 'For more detailed information, see the [link:metrics documentation].', | ||
| { | ||
| link: ( | ||
| <ExternalLink | ||
| href={`https://docs.sentry.io/platforms/javascript/guides/${docsPlatform}/metrics/`} | ||
| /> | ||
| ), | ||
| } | ||
| ), | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| verify: () => [ | ||
| { | ||
| type: StepType.VERIFY, | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: t( | ||
| 'Send a test metric from your app to verify metrics are arriving in Sentry.' | ||
| ), | ||
| }, | ||
| { | ||
| type: 'code', | ||
| language: 'javascript', | ||
| code: `const Sentry = require("${packageName}"); | ||
| // Emit a test metric | ||
| Sentry.metrics.count('test_counter', 1); | ||
| Sentry.metrics.gauge('test_gauge', 100); | ||
| Sentry.metrics.distribution('test_distribution', 150); | ||
| `, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }); | ||
|
|
||
| export const metrics = getNodeMetricsOnboarding({ | ||
| docsPlatform: 'node', | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.