Skip to content

Commit 88e9a76

Browse files
committed
feat(onboarding): Add ruby metrics
1 parent 07a885e commit 88e9a76

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

static/app/gettingStartedDocs/ruby-rack/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types';
22
import {CrashReportWebApiOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
33
import {logs} from 'sentry/gettingStartedDocs/ruby/logs';
4+
import {metrics} from 'sentry/gettingStartedDocs/ruby/metrics';
45
import {profiling} from 'sentry/gettingStartedDocs/ruby/profiling';
56

67
import {onboarding} from './onboarding';
@@ -12,6 +13,9 @@ const docs: Docs = {
1213
logsOnboarding: logs({
1314
docsPlatform: 'rack',
1415
}),
16+
metricsOnboarding: metrics({
17+
docsPlatform: 'rack',
18+
}),
1519
};
1620

1721
export default docs;

static/app/gettingStartedDocs/ruby-rails/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
replayOnboardingJsLoader,
55
} from 'sentry/gettingStartedDocs/javascript/jsLoader';
66
import {logs} from 'sentry/gettingStartedDocs/ruby/logs';
7+
import {metrics} from 'sentry/gettingStartedDocs/ruby/metrics';
78
import {profiling} from 'sentry/gettingStartedDocs/ruby/profiling';
89

910
import {crashReport} from './crashReport';
@@ -18,6 +19,9 @@ const docs: Docs = {
1819
logsOnboarding: logs({
1920
docsPlatform: 'rails',
2021
}),
22+
metricsOnboarding: metrics({
23+
docsPlatform: 'rails',
24+
}),
2125
};
2226

2327
export default docs;

static/app/gettingStartedDocs/ruby/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types';
22
import {CrashReportWebApiOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
33

44
import {logs} from './logs';
5+
import {metrics} from './metrics';
56
import {onboarding} from './onboarding';
67
import {profiling} from './profiling';
78

@@ -12,6 +13,9 @@ const docs: Docs = {
1213
logsOnboarding: logs({
1314
docsPlatform: 'ruby',
1415
}),
16+
metricsOnboarding: metrics({
17+
docsPlatform: 'ruby',
18+
}),
1519
};
1620

1721
export default docs;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import {ExternalLink} from 'sentry/components/core/link';
2+
import type {
3+
BasePlatformOptions,
4+
OnboardingConfig,
5+
} from 'sentry/components/onboarding/gettingStartedDoc/types';
6+
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types';
7+
import {tct} from 'sentry/locale';
8+
9+
export const metrics = <
10+
PlatformOptions extends BasePlatformOptions = BasePlatformOptions,
11+
>({
12+
docsPlatform,
13+
}: {
14+
docsPlatform: string;
15+
}): OnboardingConfig<PlatformOptions> => ({
16+
install: () => [
17+
{
18+
type: StepType.INSTALL,
19+
content: [
20+
{
21+
type: 'text',
22+
text: tct(
23+
"To start using metrics, make sure your Sentry Ruby SDK version is [code:6.3.0] or higher. If you're on an older major version of the SDK, follow our [link:migration guide] to upgrade.",
24+
{
25+
code: <code />,
26+
link: (
27+
<ExternalLink
28+
href={
29+
docsPlatform === 'ruby'
30+
? 'https://docs.sentry.io/platforms/ruby/migration/'
31+
: `https://docs.sentry.io/platforms/ruby/guides/${docsPlatform}/migration/`
32+
}
33+
/>
34+
),
35+
}
36+
),
37+
},
38+
{
39+
type: 'code',
40+
language: 'bash',
41+
code: 'gem install sentry-ruby',
42+
},
43+
],
44+
},
45+
],
46+
configure: () => [],
47+
verify: params => [
48+
{
49+
type: StepType.VERIFY,
50+
content: [
51+
{
52+
type: 'text',
53+
text: tct(
54+
'Metrics are automatically enabled in your [code:Sentry.init] configuration. You can emit metrics using the [code:Sentry.metrics] API.',
55+
{
56+
code: <code />,
57+
}
58+
),
59+
},
60+
{
61+
type: 'code',
62+
language: 'ruby',
63+
code: `Sentry.init do |config|
64+
config.dsn = '${params.dsn.public}'
65+
end
66+
67+
# Counter metric
68+
Sentry::Metrics.count('test-counter', value: 10, attributes: { my_attribute: 'foo'})
69+
70+
# Gauge metric
71+
Sentry::Metrics.gauge('test-gauge', 50.0, unit: 'millisecond', attributes: { my_attribute: 'foo' })
72+
73+
# Distribution metric
74+
Sentry::Metrics.distribution('test-distribution', 20.0, unit: 'kilobyte', attributes: { my_attribute: 'foo' })`,
75+
},
76+
],
77+
},
78+
],
79+
});

0 commit comments

Comments
 (0)