Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Sentry.init({
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isLogsSelected
? `
// Enable logs to be sent to Sentry
enableLogs: true,`
: ''
}${
params.isProfilingSelected
? `
Expand Down Expand Up @@ -334,6 +340,17 @@ export const onboarding: OnboardingConfig = {
});
}

if (params.isMetricsSelected) {
steps.push({
id: 'metrics',
name: t('Application Metrics'),
description: t(
'Learn how to track custom metrics to monitor your application performance and business KPIs.'
),
link: 'https://docs.sentry.io/platforms/javascript/guides/solidstart/metrics/',
});
}

return steps;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ const getDynamicParts = (params: DocsParams): string[] => {
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.`);
}

if (params.isLogsSelected) {
dynamicParts.push(`
// Enable logs to be sent to Sentry
enableLogs: true`);
}

if (params.isProfilingSelected) {
dynamicParts.push(`
// Set profileSessionSampleRate to 1.0 to profile during every session.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,14 @@ const route = createRoute({
code: `<button
type="button"
onClick={() => {${
params.isLogsSelected
? `
// Send a log before throwing the error
Sentry.logger.info('User triggered test error', {
action: 'test_error_button_click',
});`
: ''
}${
params.isMetricsSelected
? `
// Send a test metric before throwing the error
Expand Down Expand Up @@ -633,4 +641,31 @@ export const Route = createFileRoute("/api/sentry-example")({
],
},
],
nextSteps: params => {
const steps = [];

if (params.isLogsSelected) {
steps.push({
id: 'logs',
name: t('Logging Integrations'),
description: t(
'Add logging integrations to automatically capture logs from your application.'
),
link: 'https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/logs/#integrations',
});
}

if (params.isMetricsSelected) {
steps.push({
id: 'metrics',
name: t('Application Metrics'),
description: t(
'Learn how to track custom metrics to monitor your application performance and business KPIs.'
),
link: 'https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/metrics/',
});
}

return steps;
},
};
10 changes: 9 additions & 1 deletion static/app/gettingStartedDocs/javascript-vue/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@ import {
} from './utils';

const getVerifySnippet = (params: Params) => {
const logsCode = params.isLogsSelected
? ` // Send a log before calling undefined function
Sentry.logger.info('User triggered test error', {
action: 'test_error_button_click',
});
`
: '';

const metricsCode = params.isMetricsSelected
? ` // Send a test metric before calling undefined function
Sentry.metrics.count('test_counter', 1);
`
: '';

return `${metricsCode}myUndefinedFunction();`;
return `${logsCode}${metricsCode}myUndefinedFunction();`;
};

export const onboarding: OnboardingConfig<PlatformOptions> = {
Expand Down
38 changes: 37 additions & 1 deletion static/app/gettingStartedDocs/javascript/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ const getDynamicParts = (params: Params): string[] => {
replaysOnErrorSampleRate: 1.0 // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.`);
}

if (params.isLogsSelected) {
dynamicParts.push(`
// Enable logs to be sent to Sentry
enableLogs: true`);
}

if (params.isProfilingSelected) {
dynamicParts.push(`
// Set profileSessionSampleRate to 1.0 to profile during every session.
Expand Down Expand Up @@ -146,13 +152,21 @@ export const installSnippetBlock: ContentBlock = {
};

const getVerifyJSSnippet = (params: Params) => {
const logsCode = params.isLogsSelected
? ` // Send a log before calling undefined function
Sentry.logger.info('User triggered test error', {
action: 'test_error_button_click',
});
`
: '';

const metricsCode = params.isMetricsSelected
? ` // Send a test metric before calling undefined function
Sentry.metrics.count('test_counter', 1);
`
: '';

return `${metricsCode}myUndefinedFunction();`;
return `${logsCode}${metricsCode}myUndefinedFunction();`;
};

const getVerifySnippetBlock = (params: Params): ContentBlock[] => [
Expand Down Expand Up @@ -325,6 +339,17 @@ export const loaderScriptOnboarding: OnboardingConfig<PlatformOptions> = {
},
];

if (params.isLogsSelected) {
steps.push({
id: 'logs',
name: t('Logs'),
description: t(
'Learn how to send structured logs to Sentry and correlate them with your errors.'
),
link: 'https://docs.sentry.io/platforms/javascript/logs/',
});
}

if (params.isMetricsSelected) {
steps.push({
id: 'metrics',
Expand Down Expand Up @@ -445,6 +470,17 @@ export const packageManagerOnboarding: OnboardingConfig<PlatformOptions> = {
nextSteps: (params: Params) => {
const steps = [];

if (params.isLogsSelected) {
steps.push({
id: 'logs',
name: t('Logs'),
description: t(
'Learn how to send structured logs to Sentry and correlate them with your errors.'
),
link: 'https://docs.sentry.io/platforms/javascript/logs/',
});
}

if (params.isMetricsSelected) {
steps.push({
id: 'metrics',
Expand Down
Loading