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
15 changes: 13 additions & 2 deletions static/app/components/onboarding/productSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export const platformProductAvailability = {
'apple-macos': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
bun: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.LOGS],
capacitor: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.SESSION_REPLAY],
dotnet: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
dotnet: [
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.PROFILING,
ProductSolution.LOGS,
],
'dotnet-aspnet': [ProductSolution.PERFORMANCE_MONITORING],
'dotnet-aspnetcore': [ProductSolution.PERFORMANCE_MONITORING],
'dotnet-awslambda': [ProductSolution.PERFORMANCE_MONITORING],
Expand Down Expand Up @@ -187,6 +191,7 @@ export const platformProductAvailability = {
ProductSolution.LOGS,
ProductSolution.METRICS,
],
native: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.LOGS],
node: [
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.PROFILING,
Expand Down Expand Up @@ -272,7 +277,11 @@ export const platformProductAvailability = {
ProductSolution.PROFILING,
ProductSolution.LOGS,
],
'php-symfony': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
'php-symfony': [
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.PROFILING,
ProductSolution.LOGS,
],
python: [
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.PROFILING,
Expand Down Expand Up @@ -396,6 +405,8 @@ export const platformProductAvailability = {
ProductSolution.PROFILING,
ProductSolution.LOGS,
],
unity: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.LOGS],
unreal: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.LOGS],
} as Record<PlatformKey, ProductSolution[]>;

type ProductProps = {
Expand Down
7 changes: 7 additions & 0 deletions static/app/data/platformCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ export const withLoggingOnboarding: Set<PlatformKey> = new Set([
'apple-ios',
'apple-macos',
'bun',
'cocoa-objc',
'cocoa-swift',
Comment on lines +307 to +308
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that we have several references to these platforms in the codebase, but we don’t present them as options when users create a project. My understanding is that users can also create projects through the public API - Is that why we need to include these platforms here?

'dart',
'dotnet',
'flutter',
'go',
'go-echo',
Expand Down Expand Up @@ -336,6 +339,7 @@ export const withLoggingOnboarding: Set<PlatformKey> = new Set([
'javascript-sveltekit',
'javascript-tanstackstart-react',
'javascript-vue',
'native',
'node',
'node-azurefunctions',
'node-connect',
Expand All @@ -350,6 +354,7 @@ export const withLoggingOnboarding: Set<PlatformKey> = new Set([
'node-nestjs',
'php',
'php-laravel',
'php-symfony',
'python',
'python-aiohttp',
'python-asgi',
Expand All @@ -376,6 +381,8 @@ export const withLoggingOnboarding: Set<PlatformKey> = new Set([
'ruby-rack',
'ruby-rails',
'rust',
'unity',
'unreal',
]);

// List of platforms that do not have logging support. We make use of this list in the product to not provide any Logging
Expand Down
2 changes: 2 additions & 0 deletions static/app/gettingStartedDocs/dotnet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types';

import {crashReport} from './crashReport';
import {feedback} from './feedback';
import {logs} from './logs';
import {onboarding} from './onboarding';
import {profiling} from './profiling';

Expand All @@ -10,6 +11,7 @@ const docs: Docs = {
feedbackOnboardingCrashApi: feedback,
crashReportOnboarding: crashReport,
profilingOnboarding: profiling,
logsOnboarding: logs,
};

export default docs;
90 changes: 90 additions & 0 deletions static/app/gettingStartedDocs/dotnet/logs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import {ExternalLink} from 'sentry/components/core/link';
import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {t, tct} from 'sentry/locale';

type Params = DocsParams;

export const logs: OnboardingConfig = {
install: () => [
{
type: StepType.INSTALL,
content: [
{
type: 'text',
text: tct(
'Logs in .NET are supported in Sentry .NET SDK version [code:5.14.0] and above.',
{
code: <code />,
}
),
},
],
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
content: [
{
type: 'text',
text: tct(
'To enable logging, you need to initialize the SDK with the [code:Experimental.EnableLogs] option set to [code:true].',
{
code: <code />,
}
),
},
{
type: 'code',
language: 'csharp',
code: `SentrySdk.Init(options =>
{
options.Dsn = "${params.dsn.public}";
// Enable logs to be sent to Sentry
options.Experimental.EnableLogs = true;
});`,
},
],
},
],
verify: () => [
{
type: StepType.VERIFY,
content: [
{
type: 'text',
text: t(
'Once the feature is enabled on the SDK and the SDK is initialized, you can send logs using the SentrySdk.Logger APIs.'
),
},
{
type: 'text',
text: t(
'The SentrySdk.Logger instance exposes six methods that you can use to log messages at different log levels: Trace, Debug, Info, Warning, Error, and Fatal.'
),
},
{
type: 'code',
language: 'csharp',
code: `SentrySdk.Logger.LogInfo("A simple log message");
SentrySdk.Logger.LogError("A {0} log message", "formatted");`,
},
{
type: 'text',
text: tct(
'You can also attach custom attributes via a delegate. For more information, see the [link:Integrations documentation].',
{
link: (
<ExternalLink href="https://docs.sentry.io/platforms/dotnet/logs/#integrations" />
),
}
),
},
],
},
],
};
39 changes: 39 additions & 0 deletions static/app/gettingStartedDocs/dotnet/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ SentrySdk.Init(options =>
));`
}`
: ''
}${
params.isLogsSelected
? `

// Enable logs to be sent to Sentry
options.EnableLogs = true;`
: ''
}
});`;

Expand Down Expand Up @@ -255,6 +262,38 @@ export const onboarding: OnboardingConfig = {
},
] satisfies OnboardingStep[])
: []),
...(params.isLogsSelected
? ([
{
title: t('Logs'),
content: [
{
type: 'text',
text: t(
'Once configured, you can send logs using the SentrySdk.Logger APIs:'
),
},
{
type: 'code',
language: 'csharp',
code: `SentrySdk.Logger.LogInfo("A simple log message");
SentrySdk.Logger.LogError("A {0} log message", "formatted");`,
},
{
type: 'text',
text: tct(
'Check out [link:the Logs documentation] to learn more about custom attributes and integrations.',
{
link: (
<ExternalLink href="https://docs.sentry.io/platforms/dotnet/logs/" />
),
}
),
},
],
},
] satisfies OnboardingStep[])
: []),
{
title: t('Samples'),
content: [
Expand Down
2 changes: 2 additions & 0 deletions static/app/gettingStartedDocs/native/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {CrashReportWebApiOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';

import {logs} from './logs';
import {onboarding} from './onboarding';

const docs: Docs = {
onboarding,
crashReportOnboarding: CrashReportWebApiOnboarding,
logsOnboarding: logs,
};

export default docs;
86 changes: 86 additions & 0 deletions static/app/gettingStartedDocs/native/logs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {ExternalLink} from 'sentry/components/core/link';
import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {tct} from 'sentry/locale';

type Params = DocsParams;

export const logs: OnboardingConfig = {
install: () => [
{
type: StepType.INSTALL,
content: [
{
type: 'text',
text: tct(
'Logs in Native are supported in Sentry Native SDK version [link:0.11.1] and above.',
{
link: (
<ExternalLink href="https://github.com/getsentry/sentry-native/releases/tag/0.11.1" />
),
}
),
},
],
},
],
configure: (params: Params) => [
{
type: StepType.CONFIGURE,
content: [
{
type: 'text',
text: tct(
'To enable logging, you need to initialize the SDK with the [code:enable_logs] option set to [code:true].',
{
code: <code />,
}
),
},
{
type: 'code',
language: 'c',
code: `sentry_options_t *options = sentry_options_new();
sentry_options_set_dsn(options, "${params.dsn.public}");
sentry_options_set_enable_logs(options, 1);
// set other options
sentry_init(options);`,
},
],
},
],
verify: () => [
{
type: StepType.VERIFY,
content: [
{
type: 'text',
text: tct(
'Once the feature is enabled on the SDK and the SDK is initialized, you can send logs using the [code:sentry_log_X()] APIs.',
{
code: <code />,
}
),
},
{
type: 'text',
text: tct(
'The API exposes six methods that you can use to log messages at different log levels: [code:trace], [code:debug], [code:info], [code:warn], [code:error], and [code:fatal].',
{
code: <code />,
}
),
},
{
type: 'code',
language: 'c',
code: `sentry_log_info("A simple log message");
sentry_log_error("A %s log message", "formatted");`,
},
],
},
],
};
11 changes: 11 additions & 0 deletions static/app/gettingStartedDocs/native/onboarding.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import {ProjectFixture} from 'sentry-fixture/project';

import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout';
import {screen} from 'sentry-test/reactTestingLibrary';

import docs from '.';

function renderMockRequests() {
MockApiClient.addMockResponse({
url: '/projects/org-slug/project-slug/',
body: [ProjectFixture()],
});
}

describe('getting started with native', () => {
it('renders docs correctly', () => {
renderMockRequests();

renderWithOnboardingLayout(docs);

// Renders main headings
Expand Down
Loading
Loading