Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(feedback): [1/4] add dotnet platforms to issues feedback onboarding #66561

Merged
merged 3 commits into from
Mar 8, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type ReleaseRegistrySdk = Record<
string,
{
canonical: string;
files: Record<string, {checksums: Record<string, string>}>;
main_docs_url: string;
name: string;
package_url: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,61 @@ export const getCrashReportJavaScriptInstallStep = params => [
configurations: getCrashReportModalSnippetJavaScript(params),
},
];

export function getCrashReportSDKInstallFirstStep(params) {
const version =
params.sourcePackageRegistries.data['sentry.javascript.browser'].version;
const hash =
params.sourcePackageRegistries.data['sentry.javascript.browser'].files[
'bundle.min.js'
].checksums['sha384-base64'];

return {
description: t('Make sure you have the JavaScript SDK available:'),
code: [
{
label: 'HTML',
value: 'html',
language: 'html',
code: `<script
src="https://browser.sentry-cdn.com/${version}/bundle.min.js"
integrity="sha384-${hash}"
crossorigin="anonymous"
></script>`,
},
],
};
}

export const getCrashReportGenericInstallStep = params => [
{
type: StepType.INSTALL,
configurations: [
getCrashReportSDKInstallFirstStep(params),
{
description: tct(
'You will then need to call [codeShow:showReportDialog] and pass in the generated event ID. This event ID is returned from all calls to [codeEvent:CaptureEvent] and [codeException:CaptureException]. There is also a function called [codeLast:LastEventId] that returns the ID of the most recently sent event.',
{
codeShow: <code />,
codeEvent: <code />,
codeException: <code />,
codeLast: <code />,
}
),
code: [
{
label: 'HTML',
value: 'html',
language: 'html',
code: `<script>
Sentry.init({ dsn: "${params.dsn}" });
Sentry.showReportDialog({
eventId: "{{ event_id }}",
});
</script>`,
},
],
},
],
},
];
47 changes: 47 additions & 0 deletions static/app/gettingStartedDocs/dotnet/aspnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
getCrashReportSDKInstallFirstStep,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import replayOnboardingJsLoader from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
import {t, tct} from 'sentry/locale';
import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
Expand Down Expand Up @@ -178,9 +183,51 @@ const onboarding: OnboardingConfig = {
],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => [
{
type: StepType.INSTALL,
configurations: [
getCrashReportSDKInstallFirstStep(params),
{
description: tct(
'If you are rendering the page from the server, for example on ASP.NET MVC, the [code:Error.cshtml] razor page can be:',
{code: <code />}
),
code: [
{
label: 'cshtml',
value: 'html',
language: 'html',
code: `@if (SentrySdk.LastEventId != SentryId.Empty) {
<script>
Sentry.init({ dsn: "${params.dsn}" });
Sentry.showReportDialog({ eventId: "@SentrySdk.LastEventId" });
</script>
}`,
},
],
},
],
},
],
configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/guides/aspnet/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
replayOnboardingJsLoader,
crashReportOnboarding,
};

export default docs;
Expand Down
51 changes: 51 additions & 0 deletions static/app/gettingStartedDocs/dotnet/aspnetcore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
getCrashReportSDKInstallFirstStep,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
import replayOnboardingJsLoader from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader';
import {t, tct} from 'sentry/locale';
Expand Down Expand Up @@ -199,10 +204,56 @@ const onboarding: OnboardingConfig = {
],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => [
{
type: StepType.INSTALL,
configurations: [
getCrashReportSDKInstallFirstStep(params),
{
description: tct(
'If you are rendering the page from the server, for example on ASP.NET MVC, the [code:Error.cshtml] razor page can be:',
{code: <code />}
),
code: [
{
label: 'cshtml',
value: 'html',
language: 'html',
code: `@using Sentry
@using Sentry.AspNetCore
@inject Microsoft.Extensions.Options.IOptions<SentryAspNetCoreOptions> SentryOptions

@if (SentrySdk.LastEventId != SentryId.Empty) {
<script>
Sentry.init({ dsn: "@(SentryOptions.Value.Dsn)" });
Sentry.showReportDialog({ eventId: "@SentrySdk.LastEventId" });
</script>
}`,
},
],
},
],
},
],
configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
replayOnboardingJsLoader,
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry.AspNetCore'}),
crashReportOnboarding,
};

export default docs;
21 changes: 21 additions & 0 deletions static/app/gettingStartedDocs/dotnet/awslambda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportGenericInstallStep,
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
import {csharpFeedbackOnboarding} from 'sentry/gettingStartedDocs/dotnet/dotnet';
import {t, tct} from 'sentry/locale';
Expand Down Expand Up @@ -155,10 +160,26 @@ const onboarding: OnboardingConfig = {
],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => getCrashReportGenericInstallStep(params),
configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/guides/aws-lambda/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingCrashApi: csharpFeedbackOnboarding,
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry.AspNetCore'}),
crashReportOnboarding,
};

export default docs;
19 changes: 19 additions & 0 deletions static/app/gettingStartedDocs/dotnet/dotnet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import type {
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportApiIntroduction,
getCrashReportGenericInstallStep,
getCrashReportInstallDescription,
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
import {t, tct} from 'sentry/locale';
Expand Down Expand Up @@ -244,10 +247,26 @@ SentrySdk.CaptureUserFeedback(eventId, "user@example.com", "It broke.", "The Use
nextSteps: () => [],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => getCrashReportGenericInstallStep(params),
configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingCrashApi: csharpFeedbackOnboarding,
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry'}),
crashReportOnboarding,
};

export default docs;
21 changes: 21 additions & 0 deletions static/app/gettingStartedDocs/dotnet/gcpfunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportGenericInstallStep,
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
import {csharpFeedbackOnboarding} from 'sentry/gettingStartedDocs/dotnet/dotnet';
import {t, tct} from 'sentry/locale';
Expand Down Expand Up @@ -195,12 +200,28 @@ const onboarding: OnboardingConfig = {
],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => getCrashReportGenericInstallStep(params),
configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/guides/google-cloud-functions/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingCrashApi: csharpFeedbackOnboarding,
customMetricsOnboarding: getDotnetMetricsOnboarding({
packageName: 'Sentry.Google.Cloud.Functions',
}),
crashReportOnboarding,
};

export default docs;
21 changes: 21 additions & 0 deletions static/app/gettingStartedDocs/dotnet/maui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportGenericInstallStep,
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
import {csharpFeedbackOnboarding} from 'sentry/gettingStartedDocs/dotnet/dotnet';
import {t, tct} from 'sentry/locale';
Expand Down Expand Up @@ -204,10 +209,26 @@ const onboarding: OnboardingConfig = {
],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => getCrashReportGenericInstallStep(params),
Comment on lines +213 to +214
Copy link
Member

Choose a reason for hiding this comment

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

just noticed, nit for sure, but this type of thing can be written as:

Suggested change
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => getCrashReportGenericInstallStep(params),
introduction: getCrashReportModalIntroduction,
install: getCrashReportGenericInstallStep,

as long as the props are the same (same types obvs, but also same number of props).

ie (params: Params) matches with (params) on like 214.

Places to be careful of this are like [].forEach and [].map because they pass 3 params into the callback, so if your callback is expecting an optional 2nd param it'll get something unexpected! ie: [1, 2, 3].forEach(console.log) is will print more than [1,2,3].forEach(num => console.log(num))

Copy link
Member Author

Choose a reason for hiding this comment

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

i think for the sake of having to change 60 more files i won't apply this suggestion for these PRs but will definitely keep this in mind for future PRs🫡

Copy link
Member

Choose a reason for hiding this comment

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

yes, def for other times, not now.

configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/guides/maui/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingCrashApi: csharpFeedbackOnboarding,
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry.Maui'}),
crashReportOnboarding,
};

export default docs;
21 changes: 21 additions & 0 deletions static/app/gettingStartedDocs/dotnet/uwp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import type {
DocsParams,
OnboardingConfig,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {
getCrashReportGenericInstallStep,
getCrashReportModalConfigDescription,
getCrashReportModalIntroduction,
} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding';
import {getDotnetMetricsOnboarding} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
import {csharpFeedbackOnboarding} from 'sentry/gettingStartedDocs/dotnet/dotnet';
import {t, tct} from 'sentry/locale';
Expand Down Expand Up @@ -227,10 +232,26 @@ const onboarding: OnboardingConfig = {
],
};

const crashReportOnboarding: OnboardingConfig = {
introduction: () => getCrashReportModalIntroduction(),
install: (params: Params) => getCrashReportGenericInstallStep(params),
configure: () => [
{
type: StepType.CONFIGURE,
description: getCrashReportModalConfigDescription({
link: 'https://docs.sentry.io/platforms/dotnet/guides/uwp/user-feedback/configuration/#crash-report-modal',
}),
},
],
verify: () => [],
nextSteps: () => [],
};

const docs: Docs = {
onboarding,
feedbackOnboardingCrashApi: csharpFeedbackOnboarding,
customMetricsOnboarding: getDotnetMetricsOnboarding({packageName: 'Sentry'}),
crashReportOnboarding,
};

export default docs;
Expand Down
Loading
Loading