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(onboarding): Change serverless v8 onboarding #70326

Merged
merged 1 commit into from
May 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions static/app/gettingStartedDocs/node/awslambda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const productSelection = (params: Params): ProductSelectionMap => {
};

const getSdkSetupSnippet = (params: Params) => `
${getDefaulServerlessImports({productSelection: productSelection(params)}).join('\n')}
${getDefaulServerlessImports({productSelection: productSelection(params), library: 'aws-serverless'}).join('\n')}

Sentry.AWSLambda.init({
Sentry.init({
dsn: "${params.dsn}",
integrations: [${
params.isProfilingSelected
Expand All @@ -56,17 +56,17 @@ Sentry.AWSLambda.init({
}
});

exports.handler = Sentry.AWSLambda.wrapHandler(async (event, context) => {
exports.handler = Sentry.wrapHandler(async (event, context) => {
// Your handler code
});`;

const getVerifySnippet = () => `
exports.handler = Sentry.AWSLambda.wrapHandler(async (event, context) => {
exports.handler = Sentry.wrapHandler(async (event, context) => {
throw new Error("This should show up in Sentry!")
});`;

const getMetricsConfigureSnippet = (params: DocsParams) => `
Sentry.AWSLambda.init({
Sentry.init({
dsn: "${params.dsn}",
_experiments: {
metricsAggregator: true,
Expand All @@ -77,9 +77,9 @@ const onboarding: OnboardingConfig = {
install: params => [
{
type: StepType.INSTALL,
description: t('Add the Sentry Serverless SDK as a dependency:'),
description: t('Add the Sentry AWS Serverless SDK as a dependency:'),
configurations: getInstallConfig(params, {
basePackage: '@sentry/serverless',
basePackage: '@sentry/aws-serverless',
}),
},
],
Expand Down Expand Up @@ -126,14 +126,14 @@ const customMetricsOnboarding: OnboardingConfig = {
{
type: StepType.INSTALL,
description: tct(
'You need a minimum version [codeVersion:7.91.0] of [codePackage:@sentry/serverless]:',
'You need a minimum version [codeVersion:8.0.0] of [codePackage:@sentry/aws-serverless]:',
{
codeVersion: <code />,
codePackage: <code />,
}
),
configurations: getInstallConfig(params, {
basePackage: '@sentry/serverless',
basePackage: '@sentry/aws-serverless',
}),
},
],
Expand Down
2 changes: 1 addition & 1 deletion static/app/gettingStartedDocs/node/azurefunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const getSdkSetupSnippet = (params: Params) => `

${getDefaultNodeImports({productSelection: productSelection(params)}).join('\n')}

Sentry..init({
Sentry.init({
dsn: "${params.dsn}",
integrations: [${
params.isProfilingSelected
Expand Down
18 changes: 9 additions & 9 deletions static/app/gettingStartedDocs/node/gcpfunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const productSelection = (params: Params): ProductSelectionMap => {
const getInstallSnippet = (params: Params) => `
dependencies: {
//...
"@sentry/serverless": "^7",${
"@sentry/serverless": "^8",${
params.isProfilingSelected
? `
"@sentry/profiling-node": "^1",`
Expand All @@ -40,9 +40,9 @@ dependencies: {
}`;

const getSdkSetupSnippet = (params: Params) => `
${getDefaulServerlessImports({productSelection: productSelection(params)}).join('\n')}
${getDefaulServerlessImports({productSelection: productSelection(params), library: 'google-cloud-serverless'}).join('\n')}

Sentry.GCPFunction.init({
Sentry.init({
dsn: "${params.dsn}",
integrations: [${
params.isProfilingSelected
Expand All @@ -66,31 +66,31 @@ Sentry.GCPFunction.init({
});

// Use wrapHttpFunction to instrument your http functions
exports.helloHttp = Sentry.GCPFunction.wrapHttpFunction((req, res) => {
exports.helloHttp = Sentry.wrapHttpFunction((req, res) => {
/* Your function code */
});

// Use wrapEventFunction to instrument your background functions
exports.helloEvents = Sentry.GCPFunction.wrapEventFunction(
exports.helloEvents = Sentry.wrapEventFunction(
(data, context, callback) => {
/* Your function code */
}
);

// Use wrapCloudEventFunction to instrument your CloudEvent functions
exports.helloEvents = Sentry.GCPFunction.wrapCloudEventFunction(
exports.helloEvents = Sentry.wrapCloudEventFunction(
(context, callback) => {
/* Your function code */
}
);`;

const getVerifySnippet = () => `
exports.helloHttp = Sentry.GCPFunction.wrapHttpFunction((req, res) => {
exports.helloHttp = Sentry.wrapHttpFunction((req, res) => {
throw new Error("oh, hello there!");
});`;

const getMetricsConfigureSnippet = (params: DocsParams) => `
Sentry.GCPFunction.init({
Sentry.init({
dsn: "${params.dsn}",
_experiments: {
metricsAggregator: true,
Expand Down Expand Up @@ -153,7 +153,7 @@ const customMetricsOnboarding: OnboardingConfig = {
{
type: StepType.INSTALL,
description: tct(
'You need a minimum version [codeVersion:7.91.0] of [codePackage:@sentry/serverless]:',
'You need a minimum version [codeVersion:8.0.0] of [codePackage:@sentry/google-cloud-serverless]:',
{
codeVersion: <code />,
codePackage: <code />,
Expand Down
6 changes: 4 additions & 2 deletions static/app/utils/gettingStartedDocs/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ export function getDefaultNodeImports({

export function getDefaulServerlessImports({
productSelection,
library,
}: {
library: `google-cloud-serverless` | `aws-serverless`;
productSelection: ProductSelectionMap;
}) {
const imports: string[] = [
`// You can also use ESM \`import * as Sentry from "@sentry/serverless"\` instead of \`require\``,
`const Sentry = require("@sentry/serverless");`,
`// You can also use ESM \`import * as Sentry from "@sentry/${library}"\` instead of \`require\``,
`const Sentry = require("@sentry/${library}");`,
];
if (productSelection.profiling) {
imports.push(
Expand Down