|
@@ -5,73 +5,24 @@ import {Alert} from 'sentry/components/alert';
|
|
import ExternalLink from 'sentry/components/links/externalLink';
|
|
import ExternalLink from 'sentry/components/links/externalLink';
|
|
import List from 'sentry/components/list';
|
|
import List from 'sentry/components/list';
|
|
import ListItem from 'sentry/components/list/listItem';
|
|
import ListItem from 'sentry/components/list/listItem';
|
|
-import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout';
|
|
|
|
-import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation';
|
|
|
|
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
|
|
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
|
|
|
|
+import type {
|
|
|
|
+ Docs,
|
|
|
|
+ DocsParams,
|
|
|
|
+ OnboardingConfig,
|
|
|
|
+} from 'sentry/components/onboarding/gettingStartedDoc/types';
|
|
import {t, tct} from 'sentry/locale';
|
|
import {t, tct} from 'sentry/locale';
|
|
|
|
+import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
|
|
|
|
|
|
-// Configuration Start
|
|
|
|
-export const steps = ({
|
|
|
|
- dsn,
|
|
|
|
- sourcePackageRegistries,
|
|
|
|
-}: Partial<
|
|
|
|
- Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
|
|
|
|
-> = {}): LayoutProps['steps'] => [
|
|
|
|
- {
|
|
|
|
- type: StepType.INSTALL,
|
|
|
|
- description: (
|
|
|
|
- <p>
|
|
|
|
- {tct('Install the [strong:NuGet] package:', {
|
|
|
|
- strong: <strong />,
|
|
|
|
- })}
|
|
|
|
- </p>
|
|
|
|
- ),
|
|
|
|
- configurations: [
|
|
|
|
- {
|
|
|
|
- language: 'shell',
|
|
|
|
- partialLoading: sourcePackageRegistries?.isLoading,
|
|
|
|
- code: `
|
|
|
|
-# Using Package Manager
|
|
|
|
-Install-Package Sentry -Version ${
|
|
|
|
- sourcePackageRegistries?.isLoading
|
|
|
|
- ? t('\u2026loading')
|
|
|
|
- : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
|
|
|
|
- }
|
|
|
|
|
|
+type Params = DocsParams;
|
|
|
|
|
|
-# Or using .NET Core CLI
|
|
|
|
-dotnet add package Sentry -v ${
|
|
|
|
- sourcePackageRegistries?.isLoading
|
|
|
|
- ? t('\u2026loading')
|
|
|
|
- : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
|
|
|
|
- }
|
|
|
|
- `,
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- additionalInfo: (
|
|
|
|
- <AlertWithoutMarginBottom type="info">
|
|
|
|
- {tct(
|
|
|
|
- '[strong:Using .NET Framework prior to 4.6.1?] Our legacy SDK supports .NET Framework as early as 3.5.',
|
|
|
|
- {strong: <strong />}
|
|
|
|
- )}
|
|
|
|
- </AlertWithoutMarginBottom>
|
|
|
|
- ),
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- type: StepType.CONFIGURE,
|
|
|
|
- description: (
|
|
|
|
- <p>
|
|
|
|
- {tct(
|
|
|
|
- 'Initialize the SDK as early as possible, like in the constructor of the [code:App]:',
|
|
|
|
- {
|
|
|
|
- code: <code />,
|
|
|
|
- }
|
|
|
|
- )}
|
|
|
|
- </p>
|
|
|
|
- ),
|
|
|
|
- configurations: [
|
|
|
|
- {
|
|
|
|
- language: 'csharp',
|
|
|
|
- code: `
|
|
|
|
|
|
+const getInstallSnippetPackageManager = (params: Params) => `
|
|
|
|
+Install-Package Sentry -Version ${getPackageVersion(params, 'sentry.dotnet', '3.34.0')}`;
|
|
|
|
+
|
|
|
|
+const getInstallSnippetCoreCli = (params: Params) => `
|
|
|
|
+dotnet add package Sentry -v ${getPackageVersion(params, 'sentry.dotnet', '3.34.0')}`;
|
|
|
|
+
|
|
|
|
+const getConfigureSnippet = (params: Params) => `
|
|
using System.Windows;
|
|
using System.Windows;
|
|
using Sentry.Protocol;
|
|
using Sentry.Protocol;
|
|
using Sentry;
|
|
using Sentry;
|
|
@@ -83,7 +34,7 @@ sealed partial class App : Application
|
|
SentrySdk.Init(o =>
|
|
SentrySdk.Init(o =>
|
|
{
|
|
{
|
|
// Tells which project in Sentry to send events to:
|
|
// Tells which project in Sentry to send events to:
|
|
- o.Dsn = "${dsn}";
|
|
|
|
|
|
+ o.Dsn = "${params.dsn}";
|
|
// When configuring for the first time, to see what the SDK is doing:
|
|
// When configuring for the first time, to see what the SDK is doing:
|
|
o.Debug = true;
|
|
o.Debug = true;
|
|
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
|
|
// Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
|
|
@@ -108,43 +59,9 @@ sealed partial class App : Application
|
|
SentrySdk.FlushAsync(TimeSpan.FromSeconds(3)).Wait();
|
|
SentrySdk.FlushAsync(TimeSpan.FromSeconds(3)).Wait();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
- `,
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- type: StepType.VERIFY,
|
|
|
|
- description: t('To verify your set up, you can capture a message with the SDK:'),
|
|
|
|
- configurations: [
|
|
|
|
- {
|
|
|
|
- language: 'csharp',
|
|
|
|
- code: 'SentrySdk.CaptureMessage("Hello Sentry");',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- additionalInfo: (
|
|
|
|
- <p>
|
|
|
|
- {tct(
|
|
|
|
- "If you don't want to depend on the static class, the SDK registers a client in the DI container. In this case, you can [link:take [code:IHub] as a dependency].",
|
|
|
|
- {
|
|
|
|
- code: <code />,
|
|
|
|
- link: (
|
|
|
|
- <ExternalLink href="https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/unit-testing/" />
|
|
|
|
- ),
|
|
|
|
- }
|
|
|
|
- )}
|
|
|
|
- </p>
|
|
|
|
- ),
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: t('Performance Monitoring'),
|
|
|
|
- description: t(
|
|
|
|
- 'You can measure the performance of your code by capturing transactions and spans.'
|
|
|
|
- ),
|
|
|
|
- configurations: [
|
|
|
|
- {
|
|
|
|
- language: 'csharp',
|
|
|
|
- code: `
|
|
|
|
|
|
+}`;
|
|
|
|
+
|
|
|
|
+const getPerformanceInstrumentationSnippet = () => `
|
|
// Transaction can be started by providing, at minimum, the name and the operation
|
|
// Transaction can be started by providing, at minimum, the name and the operation
|
|
var transaction = SentrySdk.StartTransaction(
|
|
var transaction = SentrySdk.StartTransaction(
|
|
"test-transaction-name",
|
|
"test-transaction-name",
|
|
@@ -159,90 +76,160 @@ var span = transaction.StartChild("test-child-operation");
|
|
// ...
|
|
// ...
|
|
|
|
|
|
span.Finish(); // Mark the span as finished
|
|
span.Finish(); // Mark the span as finished
|
|
-transaction.Finish(); // Mark the transaction as finished and send it to Sentry
|
|
|
|
- `,
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- additionalInfo: (
|
|
|
|
- <p>
|
|
|
|
- {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/" />
|
|
|
|
- ),
|
|
|
|
- }
|
|
|
|
- )}
|
|
|
|
- </p>
|
|
|
|
- ),
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: t('Documentation'),
|
|
|
|
- description: (
|
|
|
|
- <p>
|
|
|
|
- {tct(
|
|
|
|
- "Once you've verified the package is initialized properly and sent a test event, consider visiting our [link:complete UWP docs].",
|
|
|
|
- {
|
|
|
|
- link: (
|
|
|
|
- <ExternalLink href="https://docs.sentry.io/platforms/dotnet/guides/uwp/" />
|
|
|
|
- ),
|
|
|
|
- }
|
|
|
|
- )}
|
|
|
|
- </p>
|
|
|
|
- ),
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: t('Samples'),
|
|
|
|
- description: (
|
|
|
|
- <Fragment>
|
|
|
|
- <p>
|
|
|
|
- {tct(
|
|
|
|
- 'You can find an example UWP app with Sentry integrated [link:on this GitHub repository].',
|
|
|
|
|
|
+transaction.Finish(); // Mark the transaction as finished and send it to Sentry`;
|
|
|
|
+
|
|
|
|
+const onboarding: OnboardingConfig = {
|
|
|
|
+ install: params => [
|
|
|
|
+ {
|
|
|
|
+ type: StepType.INSTALL,
|
|
|
|
+ description: tct('Install the [strong:NuGet] package:', {
|
|
|
|
+ strong: <strong />,
|
|
|
|
+ }),
|
|
|
|
+ configurations: [
|
|
|
|
+ {
|
|
|
|
+ partialLoading: params.sourcePackageRegistries.isLoading,
|
|
|
|
+ code: [
|
|
|
|
+ {
|
|
|
|
+ language: 'shell',
|
|
|
|
+ label: 'Package Manager',
|
|
|
|
+ value: 'packageManager',
|
|
|
|
+ code: getInstallSnippetPackageManager(params),
|
|
|
|
+ },
|
|
{
|
|
{
|
|
- link: (
|
|
|
|
- <ExternalLink href="https://github.com/getsentry/examples/tree/master/dotnet/UwpCSharp" />
|
|
|
|
- ),
|
|
|
|
- }
|
|
|
|
|
|
+ language: 'shell',
|
|
|
|
+ label: '.NET Core CLI',
|
|
|
|
+ value: 'coreCli',
|
|
|
|
+ code: getInstallSnippetCoreCli(params),
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ additionalInfo: (
|
|
|
|
+ <AlertWithoutMarginBottom type="info">
|
|
|
|
+ {tct(
|
|
|
|
+ '[strong:Using .NET Framework prior to 4.6.1?] Our legacy SDK supports .NET Framework as early as 3.5.',
|
|
|
|
+ {strong: <strong />}
|
|
)}
|
|
)}
|
|
- </p>
|
|
|
|
- {t(
|
|
|
|
- 'See the following examples that demonstrate how to integrate Sentry with various frameworks.'
|
|
|
|
- )}
|
|
|
|
- <List symbol="bullet">
|
|
|
|
- <ListItem>
|
|
|
|
|
|
+ </AlertWithoutMarginBottom>
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ configure: params => [
|
|
|
|
+ {
|
|
|
|
+ type: StepType.CONFIGURE,
|
|
|
|
+ description: tct(
|
|
|
|
+ 'Initialize the SDK as early as possible, like in the constructor of the [code:App]:',
|
|
|
|
+ {
|
|
|
|
+ code: <code />,
|
|
|
|
+ }
|
|
|
|
+ ),
|
|
|
|
+ configurations: [
|
|
|
|
+ {
|
|
|
|
+ language: 'csharp',
|
|
|
|
+ code: getConfigureSnippet(params),
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ verify: () => [
|
|
|
|
+ {
|
|
|
|
+ type: StepType.VERIFY,
|
|
|
|
+ description: t('To verify your set up, you can capture a message with the SDK:'),
|
|
|
|
+ configurations: [
|
|
|
|
+ {
|
|
|
|
+ language: 'csharp',
|
|
|
|
+ code: 'SentrySdk.CaptureMessage("Hello Sentry");',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ additionalInfo: tct(
|
|
|
|
+ "If you don't want to depend on the static class, the SDK registers a client in the DI container. In this case, you can [link:take [code:IHub] as a dependency].",
|
|
|
|
+ {
|
|
|
|
+ code: <code />,
|
|
|
|
+ link: (
|
|
|
|
+ <ExternalLink href="https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/unit-testing/" />
|
|
|
|
+ ),
|
|
|
|
+ }
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: t('Performance Monitoring'),
|
|
|
|
+ description: t(
|
|
|
|
+ 'You can measure the performance of your code by capturing transactions and spans.'
|
|
|
|
+ ),
|
|
|
|
+ configurations: [
|
|
|
|
+ {
|
|
|
|
+ language: 'csharp',
|
|
|
|
+ code: getPerformanceInstrumentationSnippet(),
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ 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('Documentation'),
|
|
|
|
+ description: tct(
|
|
|
|
+ "Once you've verified the package is initialized properly and sent a test event, consider visiting our [link:complete UWP docs].",
|
|
|
|
+ {
|
|
|
|
+ link: (
|
|
|
|
+ <ExternalLink href="https://docs.sentry.io/platforms/dotnet/guides/uwp/" />
|
|
|
|
+ ),
|
|
|
|
+ }
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: t('Samples'),
|
|
|
|
+ description: (
|
|
|
|
+ <Fragment>
|
|
|
|
+ <p>
|
|
{tct(
|
|
{tct(
|
|
- '[link:Multiple samples in the [code:dotnet] SDK repository] [strong:(C#)]',
|
|
|
|
|
|
+ 'You can find an example UWP app with Sentry integrated [link:on this GitHub repository].',
|
|
{
|
|
{
|
|
link: (
|
|
link: (
|
|
- <ExternalLink href="https://github.com/getsentry/sentry-dotnet/tree/main/samples" />
|
|
|
|
|
|
+ <ExternalLink href="https://github.com/getsentry/examples/tree/master/dotnet/UwpCSharp" />
|
|
),
|
|
),
|
|
- code: <code />,
|
|
|
|
- strong: <strong />,
|
|
|
|
}
|
|
}
|
|
)}
|
|
)}
|
|
- </ListItem>
|
|
|
|
- <ListItem>
|
|
|
|
- {tct('[link:Basic F# sample] [strong:(F#)]', {
|
|
|
|
- link: <ExternalLink href="https://github.com/sentry-demos/fsharp" />,
|
|
|
|
- strong: <strong />,
|
|
|
|
- })}
|
|
|
|
- </ListItem>
|
|
|
|
- </List>
|
|
|
|
- </Fragment>
|
|
|
|
- ),
|
|
|
|
- },
|
|
|
|
-];
|
|
|
|
-// Configuration End
|
|
|
|
|
|
+ </p>
|
|
|
|
+ {t(
|
|
|
|
+ 'See the following examples that demonstrate how to integrate Sentry with various frameworks.'
|
|
|
|
+ )}
|
|
|
|
+ <List symbol="bullet">
|
|
|
|
+ <ListItem>
|
|
|
|
+ {tct(
|
|
|
|
+ '[link:Multiple samples in the [code:dotnet] SDK repository] [strong:(C#)]',
|
|
|
|
+ {
|
|
|
|
+ link: (
|
|
|
|
+ <ExternalLink href="https://github.com/getsentry/sentry-dotnet/tree/main/samples" />
|
|
|
|
+ ),
|
|
|
|
+ code: <code />,
|
|
|
|
+ strong: <strong />,
|
|
|
|
+ }
|
|
|
|
+ )}
|
|
|
|
+ </ListItem>
|
|
|
|
+ <ListItem>
|
|
|
|
+ {tct('[link:Basic F# sample] [strong:(F#)]', {
|
|
|
|
+ link: <ExternalLink href="https://github.com/sentry-demos/fsharp" />,
|
|
|
|
+ strong: <strong />,
|
|
|
|
+ })}
|
|
|
|
+ </ListItem>
|
|
|
|
+ </List>
|
|
|
|
+ </Fragment>
|
|
|
|
+ ),
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+};
|
|
|
|
|
|
-export function GettingStartedWithUwp({
|
|
|
|
- dsn,
|
|
|
|
- sourcePackageRegistries,
|
|
|
|
- ...props
|
|
|
|
-}: ModuleProps) {
|
|
|
|
- return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
|
|
|
|
-}
|
|
|
|
|
|
+const docs: Docs = {
|
|
|
|
+ onboarding,
|
|
|
|
+};
|
|
|
|
|
|
-export default GettingStartedWithUwp;
|
|
|
|
|
|
+export default docs;
|
|
|
|
|
|
const AlertWithoutMarginBottom = styled(Alert)`
|
|
const AlertWithoutMarginBottom = styled(Alert)`
|
|
margin-bottom: 0;
|
|
margin-bottom: 0;
|