Skip to content

Commit 7884c8f

Browse files
authored
feat(ddm-onboarding): Add dotnet instructions (#63194)
Add custom metrics onboarding instructions for `dotnet`, `dotnet-aspnetcore`, `dotnet-awslambda`, `dotnet-gcpfunctions`, `dotnet-maui`, `dotnet-uwp`, `dotnet-winforms` and `dotnet-wpf`. - closes #63180
1 parent e190f43 commit 7884c8f

File tree

11 files changed

+117
-2
lines changed

11 files changed

+117
-2
lines changed

static/app/components/onboarding/gettingStartedDoc/utils/metricsOnboarding.tsx

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const getJSServerMetricsOnboarding = (): OnboardingConfig => ({
118118
{
119119
type: StepType.INSTALL,
120120
description: tct(
121-
'You need a minimum version [codeVersion:4.17.0] of [codeNode:@sentry/node], [codeDeno:@sentry/deno] or [codeBun:@sentry/bun].',
121+
'You need a minimum version [codeVersion:7.91.0] of [codeNode:@sentry/node], [codeDeno:@sentry/deno] or [codeBun:@sentry/bun].',
122122
{
123123
codeVersion: <code />,
124124
codeNode: <code />,
@@ -300,3 +300,92 @@ export const getPythonMetricsOnboarding = ({
300300
},
301301
],
302302
});
303+
304+
const getDotnetConfigureSnippet = (params: DocsParams) => `
305+
SentrySdk.Init(options =>
306+
{
307+
options.Dsn = "${params.dsn}";
308+
options.ExperimentalMetrics = new ExperimentalMetricsOptions
309+
{
310+
EnableCodeLocations = true
311+
};
312+
});`;
313+
314+
const getDotnetVerifySnippet = () => `
315+
SentrySdk.Metrics.Increment(
316+
"drank-drinks",
317+
tags:new Dictionary<string, string> {{"kind", "coffee"}}
318+
);`;
319+
320+
export const getDotnetMetricsOnboarding = ({
321+
packageName,
322+
}: {
323+
packageName: string;
324+
}): OnboardingConfig => ({
325+
install: () => [
326+
{
327+
type: StepType.INSTALL,
328+
description: tct(
329+
'You need a minimum version [codeVersion:4.0.0-beta.8] of the .NET SDK installed',
330+
{
331+
codeVersion: <code />,
332+
}
333+
),
334+
configurations: [
335+
{
336+
language: 'powershell',
337+
code: `dotnet add package ${packageName} -v 4.0.0-beta.8`,
338+
},
339+
],
340+
},
341+
],
342+
configure: params => [
343+
{
344+
type: StepType.CONFIGURE,
345+
description: t(
346+
'Once the SDK is installed or updated, you can enable the experimental metrics feature and code locations being emitted in your SDK init.'
347+
),
348+
configurations: [
349+
{
350+
language: 'csharp',
351+
code: getDotnetConfigureSnippet(params),
352+
},
353+
],
354+
},
355+
],
356+
verify: () => [
357+
{
358+
type: StepType.VERIFY,
359+
description: tct(
360+
"Then you'll be able to add metrics as [codeCounters:counters], [codeSets:sets], [codeDistribution:distributions], and [codeGauge:gauges]. Try out this example:",
361+
{
362+
codeCounters: <code />,
363+
codeSets: <code />,
364+
codeDistribution: <code />,
365+
codeGauge: <code />,
366+
}
367+
),
368+
configurations: [
369+
{
370+
language: 'csharp',
371+
code: getDotnetVerifySnippet(),
372+
},
373+
{
374+
description: t(
375+
'With a bit of delay you can see the data appear in the Sentry UI.'
376+
),
377+
},
378+
{
379+
description: tct(
380+
'Learn more about metrics and how to configure them, by reading the [docsLink:docs].',
381+
{
382+
docsLink: (
383+
<ExternalLink href="https://github.com/getsentry/sentry-laravel/discussions/823" />
384+
),
385+
}
386+
),
387+
},
388+
],
389+
},
390+
],
391+
});

static/app/data/platformCategories.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,14 @@ export const replayJsLoaderInstructionsPlatformList: readonly PlatformKey[] = [
379379

380380
const customMetricBackendPlatforms: readonly PlatformKey[] = [
381381
'bun',
382+
'dotnet',
383+
'dotnet-aspnetcore',
384+
'dotnet-awslambda',
385+
'dotnet-gcpfunctions',
386+
'dotnet-maui',
387+
'dotnet-uwp',
388+
'dotnet-winforms',
389+
'dotnet-wpf',
382390
'php',
383391
'php-laravel',
384392
// TODO: Enable once metrics are available for Symfony

static/app/gettingStartedDocs/bun/bun.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const customMetricsOnboarding: OnboardingConfig = {
107107
{
108108
type: StepType.INSTALL,
109109
description: tct(
110-
'You need a minimum version [codeVersion:4.17.0] of [codePackage:@sentry/bun].',
110+
'You need a minimum version [codeVersion:7.91.0] of [codePackage:@sentry/bun].',
111111
{
112112
codeVersion: <code />,
113113
codePackage: <code />,

static/app/gettingStartedDocs/dotnet/aspnetcore.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
DocsParams,
1010
OnboardingConfig,
1111
} from 'sentry/components/onboarding/gettingStartedDoc/types';
12+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1213
import replayOnboardingJsLoader from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
1314
import {t, tct} from 'sentry/locale';
1415
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
@@ -233,6 +234,7 @@ const onboarding: OnboardingConfig = {
233234
const docs: Docs = {
234235
onboarding,
235236
replayOnboardingJsLoader,
237+
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry.AspNetCore'}),
236238
};
237239

238240
export default docs;

static/app/gettingStartedDocs/dotnet/awslambda.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
DocsParams,
88
OnboardingConfig,
99
} from 'sentry/components/onboarding/gettingStartedDoc/types';
10+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1011
import {t, tct} from 'sentry/locale';
1112
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
1213

@@ -155,6 +156,7 @@ const onboarding: OnboardingConfig = {
155156

156157
const docs: Docs = {
157158
onboarding,
159+
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry.AspNetCore'}),
158160
};
159161

160162
export default docs;

static/app/gettingStartedDocs/dotnet/dotnet.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
DocsParams,
1010
OnboardingConfig,
1111
} from 'sentry/components/onboarding/gettingStartedDoc/types';
12+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1213
import {t, tct} from 'sentry/locale';
1314
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
1415

@@ -200,6 +201,7 @@ const onboarding: OnboardingConfig = {
200201

201202
const docs: Docs = {
202203
onboarding,
204+
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry'}),
203205
};
204206

205207
export default docs;

static/app/gettingStartedDocs/dotnet/gcpfunctions.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
DocsParams,
1010
OnboardingConfig,
1111
} from 'sentry/components/onboarding/gettingStartedDoc/types';
12+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1213
import {t, tct} from 'sentry/locale';
1314
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
1415

@@ -195,6 +196,9 @@ const onboarding: OnboardingConfig = {
195196

196197
const docs: Docs = {
197198
onboarding,
199+
customMetricsOnboarding: getDotnetMetricsOnboarding({
200+
packageName: 'Sentry.Google.Cloud.Functions',
201+
}),
198202
};
199203

200204
export default docs;

static/app/gettingStartedDocs/dotnet/maui.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
DocsParams,
88
OnboardingConfig,
99
} from 'sentry/components/onboarding/gettingStartedDoc/types';
10+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1011
import {t, tct} from 'sentry/locale';
1112
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
1213

@@ -204,6 +205,7 @@ const onboarding: OnboardingConfig = {
204205

205206
const docs: Docs = {
206207
onboarding,
208+
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry.Maui'}),
207209
};
208210

209211
export default docs;

static/app/gettingStartedDocs/dotnet/uwp.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
DocsParams,
1212
OnboardingConfig,
1313
} from 'sentry/components/onboarding/gettingStartedDoc/types';
14+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1415
import {t, tct} from 'sentry/locale';
1516
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
1617

@@ -227,6 +228,7 @@ const onboarding: OnboardingConfig = {
227228

228229
const docs: Docs = {
229230
onboarding,
231+
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry'}),
230232
};
231233

232234
export default docs;

static/app/gettingStartedDocs/dotnet/winforms.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
DocsParams,
1212
OnboardingConfig,
1313
} from 'sentry/components/onboarding/gettingStartedDoc/types';
14+
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
1415
import {t, tct} from 'sentry/locale';
1516
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
1617

@@ -199,6 +200,7 @@ const onboarding: OnboardingConfig = {
199200

200201
const docs: Docs = {
201202
onboarding,
203+
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry'}),
202204
};
203205

204206
export default docs;

0 commit comments

Comments
 (0)