|
@@ -1,5 +1,7 @@
|
|
|
import {Fragment} from 'react';
|
|
|
+import styled from '@emotion/styled';
|
|
|
|
|
|
+import {Alert} from 'sentry/components/alert';
|
|
|
import ExternalLink from 'sentry/components/links/externalLink';
|
|
|
import List from 'sentry/components/list';
|
|
|
import ListItem from 'sentry/components/list/listItem';
|
|
@@ -24,12 +26,39 @@ import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersi
|
|
|
type Params = DocsParams;
|
|
|
|
|
|
const getInstallSnippetPackageManager = (params: Params) => `
|
|
|
-Install-Package Sentry -Version ${getPackageVersion(params, 'sentry.dotnet', '3.34.0')}`;
|
|
|
+Install-Package Sentry -Version ${getPackageVersion(
|
|
|
+ params,
|
|
|
+ 'sentry.dotnet',
|
|
|
+ params.isProfilingSelected ? '4.3.0' : '3.34.0'
|
|
|
+)}`;
|
|
|
|
|
|
const getInstallSnippetCoreCli = (params: Params) => `
|
|
|
-dotnet add package Sentry -v ${getPackageVersion(params, 'sentry.dotnet', '3.34.0')}`;
|
|
|
+dotnet add package Sentry -v ${getPackageVersion(
|
|
|
+ params,
|
|
|
+ 'sentry.dotnet',
|
|
|
+ params.isProfilingSelected ? '4.3.0' : '3.34.0'
|
|
|
+)}`;
|
|
|
|
|
|
-const getConfigureSnippet = (params: Params) => `
|
|
|
+const getInstallProfilingSnippetPackageManager = (params: Params) => `
|
|
|
+Install-Package Sentry.Profiling -Version ${getPackageVersion(
|
|
|
+ params,
|
|
|
+ 'sentry.dotnet.profiling',
|
|
|
+ '4.3.0'
|
|
|
+)}`;
|
|
|
+
|
|
|
+const getInstallProfilingSnippetCoreCli = (params: Params) => `
|
|
|
+dotnet add package Sentry.Profiling -v ${getPackageVersion(
|
|
|
+ params,
|
|
|
+ 'sentry.dotnet.profiling',
|
|
|
+ '4.3.0'
|
|
|
+)}`;
|
|
|
+
|
|
|
+enum DotNetPlatform {
|
|
|
+ WINDOWS,
|
|
|
+ IOS_MACCATALYST,
|
|
|
+}
|
|
|
+
|
|
|
+const getConfigureSnippet = (params: Params, platform?: DotNetPlatform) => `
|
|
|
using Sentry;
|
|
|
|
|
|
SentrySdk.Init(options =>
|
|
@@ -46,14 +75,38 @@ SentrySdk.Init(options =>
|
|
|
options.Debug = true;
|
|
|
|
|
|
// This option is recommended. It enables Sentry's "Release Health" feature.
|
|
|
- options.AutoSessionTracking = true;
|
|
|
+ options.AutoSessionTracking = true;${
|
|
|
+ params.isPerformanceSelected
|
|
|
+ ? `
|
|
|
|
|
|
- // This option is recommended for client applications only. It ensures all threads use the same global scope.
|
|
|
- // If you're writing a background service of any kind, you should remove this.
|
|
|
- options.IsGlobalModeEnabled = true;
|
|
|
+ // Set TracesSampleRate to 1.0 to capture 100%
|
|
|
+ // of transactions for performance monitoring.
|
|
|
+ // We recommend adjusting this value in production.
|
|
|
+ options.TracesSampleRate = 1.0;`
|
|
|
+ : ''
|
|
|
+ }${
|
|
|
+ params.isProfilingSelected
|
|
|
+ ? `
|
|
|
|
|
|
- // This option will enable Sentry's tracing features. You still need to start transactions and spans.
|
|
|
- options.EnableTracing = true;
|
|
|
+ // Sample rate for profiling, applied on top of othe TracesSampleRate,
|
|
|
+ // e.g. 0.2 means we want to profile 20 % of the captured transactions.
|
|
|
+ // We recommend adjusting this value in production.
|
|
|
+ options.ProfilesSampleRate = 1.0;${
|
|
|
+ platform !== DotNetPlatform.IOS_MACCATALYST
|
|
|
+ ? `
|
|
|
+ // Requires NuGet package: Sentry.Profiling
|
|
|
+ // Note: By default, the profiler is initialized asynchronously. This can
|
|
|
+ // be tuned by passing a desired initialization timeout to the constructor.
|
|
|
+ options.AddIntegration(new ProfilingIntegration(
|
|
|
+ // During startup, wait up to 500ms to profile the app startup code.
|
|
|
+ // This could make launching the app a bit slower so comment it out if you
|
|
|
+ // prefer profiling to start asynchronously
|
|
|
+ TimeSpan.FromMilliseconds(500)
|
|
|
+ ));`
|
|
|
+ : ''
|
|
|
+ }`
|
|
|
+ : ''
|
|
|
+ }
|
|
|
});`;
|
|
|
|
|
|
const getPerformanceMonitoringSnippet = () => `
|
|
@@ -106,6 +159,41 @@ const onboarding: OnboardingConfig = {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
+ ...(params.isProfilingSelected
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ description: tct(
|
|
|
+ 'Additionally, for all platforms except iOS/Mac Catalyst, you need to add a dependency on the [sentryProfilingPackage:Sentry.Profiling] NuGet package.',
|
|
|
+ {
|
|
|
+ sentryProfilingPackage: <code />,
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ code: [
|
|
|
+ {
|
|
|
+ language: 'shell',
|
|
|
+ label: 'Package Manager',
|
|
|
+ value: 'packageManager',
|
|
|
+ code: getInstallProfilingSnippetPackageManager(params),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ language: 'shell',
|
|
|
+ label: '.NET Core CLI',
|
|
|
+ value: 'coreCli',
|
|
|
+ code: getInstallProfilingSnippetCoreCli(params),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ description: (
|
|
|
+ <AlertWithoutMarginBottom type="info">
|
|
|
+ {t(
|
|
|
+ 'Profiling for .NET Framework and .NET on Android are not supported.'
|
|
|
+ )}
|
|
|
+ </AlertWithoutMarginBottom>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : []),
|
|
|
],
|
|
|
},
|
|
|
],
|
|
@@ -120,14 +208,31 @@ const onboarding: OnboardingConfig = {
|
|
|
}
|
|
|
),
|
|
|
configurations: [
|
|
|
- {
|
|
|
- language: 'csharp',
|
|
|
- code: getConfigureSnippet(params),
|
|
|
- },
|
|
|
+ params.isProfilingSelected
|
|
|
+ ? {
|
|
|
+ code: [
|
|
|
+ {
|
|
|
+ language: 'csharp',
|
|
|
+ label: 'Windows/Linux/macOS',
|
|
|
+ value: 'windows/linux/macos',
|
|
|
+ code: getConfigureSnippet(params, DotNetPlatform.WINDOWS),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ language: 'csharp',
|
|
|
+ label: 'iOS/Mac Catalyst',
|
|
|
+ value: 'ios/macCatalyst',
|
|
|
+ code: getConfigureSnippet(params, DotNetPlatform.IOS_MACCATALYST),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ : {
|
|
|
+ language: 'csharp',
|
|
|
+ code: getConfigureSnippet(params),
|
|
|
+ },
|
|
|
],
|
|
|
},
|
|
|
],
|
|
|
- verify: () => [
|
|
|
+ verify: (params: Params) => [
|
|
|
{
|
|
|
type: StepType.VERIFY,
|
|
|
description: t('Verify Sentry is correctly configured by sending a message:'),
|
|
@@ -138,26 +243,30 @@ const onboarding: OnboardingConfig = {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- {
|
|
|
- title: t('Performance Monitoring'),
|
|
|
- description: t(
|
|
|
- 'You can measure the performance of your code by capturing transactions and spans.'
|
|
|
- ),
|
|
|
- configurations: [
|
|
|
- {
|
|
|
- language: 'csharp',
|
|
|
- code: getPerformanceMonitoringSnippet(),
|
|
|
- },
|
|
|
- ],
|
|
|
- additionalInfo: tct(
|
|
|
- 'Check out [link:the documentation] to learn more about the API and automatic instrumentations.',
|
|
|
- {
|
|
|
- link: (
|
|
|
- <ExternalLink href="https://docs.sentry.io/platforms/dotnet/performance/instrumentation/" />
|
|
|
- ),
|
|
|
- }
|
|
|
- ),
|
|
|
- },
|
|
|
+ ...(params.isPerformanceSelected
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ title: t('Performance Monitoring'),
|
|
|
+ description: t(
|
|
|
+ 'You can measure the performance of your code by capturing transactions and spans.'
|
|
|
+ ),
|
|
|
+ configurations: [
|
|
|
+ {
|
|
|
+ language: 'csharp',
|
|
|
+ code: getPerformanceMonitoringSnippet(),
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ additionalInfo: tct(
|
|
|
+ 'Check out [link:the documentation] to learn more about the API and automatic instrumentations.',
|
|
|
+ {
|
|
|
+ link: (
|
|
|
+ <ExternalLink href="https://docs.sentry.io/platforms/dotnet/performance/instrumentation/" />
|
|
|
+ ),
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : []),
|
|
|
{
|
|
|
title: t('Samples'),
|
|
|
description: (
|
|
@@ -270,3 +379,7 @@ const docs: Docs = {
|
|
|
};
|
|
|
|
|
|
export default docs;
|
|
|
+
|
|
|
+const AlertWithoutMarginBottom = styled(Alert)`
|
|
|
+ margin-bottom: 0;
|
|
|
+`;
|