Skip to content

Commit 0798ab7

Browse files
ref(onboarding): Split rust onboarding doc into multiple files (#102200)
Contributes to https://linear.app/getsentry/issue/TET-864/introduce-folders-for-onboarding-platforms
1 parent 1b4dbba commit 0798ab7

File tree

6 files changed

+255
-224
lines changed

6 files changed

+255
-224
lines changed

static/app/gettingStartedDocs/rust/rust.tsx

Lines changed: 0 additions & 223 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type {
2+
DocsParams,
3+
OnboardingConfig,
4+
} from 'sentry/components/onboarding/gettingStartedDoc/types';
5+
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types';
6+
import {
7+
getCrashReportBackendInstallSteps,
8+
getCrashReportModalConfigDescription,
9+
getCrashReportModalIntroduction,
10+
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
11+
12+
type Params = DocsParams;
13+
14+
export const crashReport: OnboardingConfig = {
15+
introduction: () => getCrashReportModalIntroduction(),
16+
install: (params: Params) => getCrashReportBackendInstallSteps(params),
17+
configure: () => [
18+
{
19+
type: StepType.CONFIGURE,
20+
content: [
21+
{
22+
type: 'text',
23+
text: getCrashReportModalConfigDescription({
24+
link: 'https://docs.sentry.io/platforms/rust/user-feedback/configuration/#crash-report-modal',
25+
}),
26+
},
27+
],
28+
},
29+
],
30+
verify: () => [],
31+
nextSteps: () => [],
32+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types';
2+
3+
import {crashReport} from './crashReport';
4+
import {logs} from './logs';
5+
import {onboarding} from './onboarding';
6+
7+
const docs: Docs = {
8+
onboarding,
9+
crashReportOnboarding: crashReport,
10+
logsOnboarding: logs,
11+
};
12+
13+
export default docs;
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import {ExternalLink} from 'sentry/components/core/link';
2+
import type {
3+
DocsParams,
4+
OnboardingConfig,
5+
} from 'sentry/components/onboarding/gettingStartedDoc/types';
6+
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types';
7+
import {t, tct} from 'sentry/locale';
8+
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
9+
10+
type Params = DocsParams;
11+
12+
const getInstallSnippet = (params: Params, defaultVersion = '0.42.0') => {
13+
const version = getPackageVersion(params, 'sentry.rust', defaultVersion);
14+
return params.isLogsSelected
15+
? `
16+
[dependencies]
17+
sentry = { version = "${version}", features = ["logs"] }`
18+
: `
19+
[dependencies]
20+
sentry = "${version}"`;
21+
};
22+
23+
export const logs: OnboardingConfig = {
24+
install: params => [
25+
{
26+
type: StepType.INSTALL,
27+
content: [
28+
{
29+
type: 'text',
30+
text: tct(
31+
'Logs in Rust are supported in Sentry Rust SDK version [code:0.42.0] and above. Additionally, the [code:logs] feature flag needs to be enabled.',
32+
{
33+
code: <code />,
34+
}
35+
),
36+
},
37+
{
38+
type: 'code',
39+
language: 'rust',
40+
code: getInstallSnippet(params, '0.42.0'),
41+
},
42+
],
43+
},
44+
],
45+
configure: (params: Params) => [
46+
{
47+
type: StepType.CONFIGURE,
48+
content: [
49+
{
50+
type: 'text',
51+
text: tct(
52+
'To enable logging, you need to initialize the SDK with the [code:enable_logs] option set to true.',
53+
{
54+
code: <code />,
55+
}
56+
),
57+
},
58+
{
59+
type: 'code',
60+
language: 'rust',
61+
code: `let _guard = sentry::init((
62+
"${params.dsn.public}",
63+
sentry::ClientOptions {
64+
release: sentry::release_name!(),
65+
enable_logs: true,
66+
..Default::default()
67+
}
68+
));`,
69+
},
70+
{
71+
type: 'text',
72+
text: tct(
73+
'Additionally, you can also configure [link:logging integrations] with crates like [code:tracing] or [code:log].',
74+
{
75+
code: <code />,
76+
link: (
77+
<ExternalLink href="https://docs.sentry.io/platforms/rust/logs/#integrations" />
78+
),
79+
}
80+
),
81+
},
82+
],
83+
},
84+
],
85+
verify: () => [
86+
{
87+
type: StepType.VERIFY,
88+
content: [
89+
{
90+
type: 'text',
91+
text: t('Send a test log from your app to verify logs are arriving in Sentry.'),
92+
},
93+
{
94+
type: 'code',
95+
language: 'rust',
96+
code: `use sentry::logger_info;
97+
98+
logger_info!(
99+
log_type = "test",
100+
log.source = "sentry_rust_sdk",
101+
"Log sent for testing"
102+
);`,
103+
},
104+
],
105+
},
106+
],
107+
};

static/app/gettingStartedDocs/rust/rust.spec.tsx renamed to static/app/gettingStartedDocs/rust/rust/onboarding.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboa
22
import {screen} from 'sentry-test/reactTestingLibrary';
33
import {textWithMarkupMatcher} from 'sentry-test/utils';
44

5-
import docs from './rust';
5+
import docs from '.';
66

77
describe('rust onboarding docs', () => {
88
it('renders onboarding docs correctly', async () => {

0 commit comments

Comments
 (0)