-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathmetrics.tsx
More file actions
126 lines (121 loc) · 3.66 KB
/
metrics.tsx
File metadata and controls
126 lines (121 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import {ExternalLink} from 'sentry/components/core/link';
import {
StepType,
type ContentBlock,
type DocsParams,
type OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getInstallSnippetCoreCli,
getInstallSnippetPackageManager,
} from 'sentry/gettingStartedDocs/dotnet/utils';
import {tct} from 'sentry/locale';
export const metricsVerify = (params: DocsParams): ContentBlock => ({
type: 'conditional',
condition: params.isMetricsSelected,
content: [
{
type: 'text',
text: tct(
'Send test metrics from your app to verify metrics are arriving in Sentry.',
{code: <code />}
),
},
{
type: 'code',
language: 'dotnet',
code: `using Sentry;
SentrySdk.Experimental.Metrics.EmitCounter("button_click", 5,
[new KeyValuePair<string, object>("browser", "Firefox"), new KeyValuePair<string, object>("app_version", "1.0.0")]);
SentrySdk.Experimental.Metrics.EmitDistribution("page_load", 15.0, SentryUnits.Duration.Millisecond,
[new KeyValuePair<string, object>("page", "/home")]);
SentrySdk.Experimental.Metrics.EmitGauge("page_load", 15.0, SentryUnits.Duration.Millisecond,
[new KeyValuePair<string, object>("page", "/home")]);
`,
},
{
type: 'text',
text: tct('For more detailed information, see the [link:metrics documentation].', {
link: (
<ExternalLink href="https://docs.sentry.io/platforms/dotnet/guides/metrics/" />
),
}),
},
],
});
export const dotnetMetrics = (): OnboardingConfig => ({
install: params => [
{
type: StepType.INSTALL,
content: [
{
type: 'text',
text: tct(
'Install our .NET SDK with a minimum version that supports metrics ([code:6.1.0] or higher).',
{
code: <code />,
}
),
},
{
type: 'code',
tabs: [
{
label: 'Package Manager',
language: 'shell',
code: getInstallSnippetPackageManager(params),
},
{
label: '.NET Core CLI',
language: 'shell',
code: getInstallSnippetCoreCli(params),
},
],
},
],
},
],
configure: () => [],
verify: (params: DocsParams) => [
{
type: StepType.VERIFY,
content: [
{
type: 'text',
text: tct(
'Metrics are automatically enabled in your [code:SentrySdk.Init] configuration. You can emit metrics using the [code:SentrySdk.Experimental.Metrics] API.',
{
code: <code />,
}
),
},
{
type: 'code',
language: 'dotnet',
code: `using Sentry;
SentrySdk.Init(options =>
{
options.Dsn = ${params.dsn.public};
});
SentrySdk.Experimental.Metrics.EmitCounter("button_click", 5,
[new KeyValuePair<string, object>("browser", "Firefox"), new KeyValuePair<string, object>("app_version", "1.0.0")]);
SentrySdk.Experimental.Metrics.EmitDistribution("page_load", 15.0, SentryUnits.Duration.Millisecond,
[new KeyValuePair<string, object>("page", "/home")]);
SentrySdk.Experimental.Metrics.EmitGauge("page_load", 15.0, SentryUnits.Duration.Millisecond,
[new KeyValuePair<string, object>("page", "/home")]);`,
},
{
type: 'text',
text: tct(
'For more detailed information, see the [link:metrics documentation].',
{
link: (
<ExternalLink href="https://docs.sentry.io/platforms/dotnet/metrics/" />
),
}
),
},
],
},
],
});