Browse Source

feat(onboarding): Add hapi, fastify and Nest.js (#70647)

Will merge this after v8 is out for a while (like 1 week or so).

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Sigrid Huemer 9 months ago
parent
commit
56b506b9ba

+ 1 - 1
package.json

@@ -138,7 +138,7 @@
     "papaparse": "^5.3.2",
     "pegjs": "^0.10.0",
     "pegjs-loader": "^0.5.6",
-    "platformicons": "^5.10.6",
+    "platformicons": "^5.10.9",
     "po-catalog-loader": "2.0.0",
     "prettier": "3.2.5",
     "prismjs": "^1.29.0",

+ 1 - 0
static/app/components/onboarding/frameworkSuggestionModal.tsx

@@ -66,6 +66,7 @@ const topPythonFrameworks: PlatformKey[] = [
 
 const topNodeFrameworks: PlatformKey[] = [
   'node-express',
+  'node-nestjs',
   'node-awslambda',
   'node-gcpfunctions',
   'node-koa',

+ 3 - 0
static/app/components/onboarding/productSelection.tsx

@@ -143,11 +143,14 @@ export const platformProductAvailability = {
   'node-awslambda': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   'node-connect': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   'node-express': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
+  'node-fastify': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   'node-gcpfunctions': [
     ProductSolution.PERFORMANCE_MONITORING,
     ProductSolution.PROFILING,
   ],
+  'node-hapi': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   'node-koa': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
+  'node-nestjs': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   php: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   'php-laravel': [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],
   ['php-symfony']: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING],

+ 4 - 0
static/app/data/platformPickerCategories.tsx

@@ -17,6 +17,7 @@ const popularPlatformCategories: Set<PlatformKey> = new Set([
   'javascript-vue',
   'node',
   'node-express',
+  'node-nestjs',
   'php',
   'php-laravel',
   'python',
@@ -70,7 +71,10 @@ const server: Set<PlatformKey> = new Set([
   'node',
   'node-connect',
   'node-express',
+  'node-fastify',
+  'node-hapi',
   'node-koa',
+  'node-nestjs',
   'php',
   'php-laravel',
   'php-symfony',

+ 21 - 0
static/app/data/platforms.tsx

@@ -403,6 +403,20 @@ export const platforms: PlatformIntegration[] = [
     language: 'node',
     link: 'https://docs.sentry.io/platforms/javascript/guides/express/',
   },
+  {
+    id: 'node-fastify',
+    name: 'Fastify',
+    type: 'framework',
+    language: 'node',
+    link: 'https://docs.sentry.io/platforms/javascript/guides/fastify/',
+  },
+  {
+    id: 'node-hapi',
+    name: 'Hapi',
+    type: 'framework',
+    language: 'node',
+    link: 'https://docs.sentry.io/platforms/javascript/guides/hapi/',
+  },
   {
     id: 'node-gcpfunctions',
     name: 'Google Cloud Functions (Node)',
@@ -417,6 +431,13 @@ export const platforms: PlatformIntegration[] = [
     language: 'node',
     link: 'https://docs.sentry.io/platforms/javascript/guides/koa/',
   },
+  {
+    id: 'node-nestjs',
+    name: 'Nest.js',
+    type: 'framework',
+    language: 'node',
+    link: 'https://docs.sentry.io/platforms/javascript/guides/nestjs/',
+  },
   {
     id: 'php',
     name: 'PHP',

+ 7 - 0
static/app/gettingStartedDocs/node/awslambda.spec.tsx

@@ -60,6 +60,13 @@ describe('awslambda onboarding docs', function () {
       selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
     });
 
+    expect(
+      screen.getByText(
+        textWithMarkupMatcher(
+          /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
+        )
+      )
+    ).toBeInTheDocument();
     expect(
       screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
     ).toBeInTheDocument();

+ 7 - 0
static/app/gettingStartedDocs/node/azurefunctions.spec.tsx

@@ -59,6 +59,13 @@ describe('express onboarding docs', function () {
       selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
     });
 
+    expect(
+      screen.getByText(
+        textWithMarkupMatcher(
+          /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
+        )
+      )
+    ).toBeInTheDocument();
     expect(
       screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
     ).toBeInTheDocument();

+ 15 - 0
static/app/gettingStartedDocs/node/connect.spec.tsx

@@ -24,6 +24,14 @@ describe('connect onboarding docs', function () {
     });
   });
 
+  it('includes error handler', () => {
+    renderWithOnboardingLayout(docs);
+
+    expect(
+      screen.getByText(textWithMarkupMatcher(/Sentry\.setupConnectErrorHandler\(app\)/))
+    ).toBeInTheDocument();
+  });
+
   it('displays sample rates by default', () => {
     renderWithOnboardingLayout(docs, {
       selectedProducts: [
@@ -59,6 +67,13 @@ describe('connect onboarding docs', function () {
       selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
     });
 
+    expect(
+      screen.getByText(
+        textWithMarkupMatcher(
+          /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
+        )
+      )
+    ).toBeInTheDocument();
     expect(
       screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
     ).toBeInTheDocument();

+ 3 - 1
static/app/gettingStartedDocs/node/connect.tsx

@@ -25,6 +25,7 @@ type Params = DocsParams;
 const getSdkSetupSnippet = () => `
 ${getImportInstrumentSnippet()}
 
+// All other imports below
 ${getSentryImportSnippet('node')}
 const connect = require("connect");
 
@@ -69,7 +70,7 @@ const onboarding: OnboardingConfig = {
         },
         {
           description: tct(
-            "Make sure to import [code1:instrument.js/mjs] at the top of your file. Set up the error handler after all controllers and before any other error middleware. This setup is typically done in your application's entry point file, which is usually [code2:index.(js|ts)]. If you are unable to import an external file, read about [docs:alternative installation methods in our docs].",
+            "Make sure to import [code1:instrument.js/mjs] at the top of your file. Set up the error handler after all controllers and before any other error middleware. This setup is typically done in your application's entry point file, which is usually [code2:index.(js|ts)]. If you're running your application in ESM mode, or looking for alternative ways to set up Sentry, read about [docs:installation methods in our docs].",
             {
               code1: <code />,
               code2: <code />,
@@ -83,6 +84,7 @@ const onboarding: OnboardingConfig = {
               label: 'JavaScript',
               value: 'javascript',
               language: 'javascript',
+              filename: 'index.(js|mjs)',
               code: getSdkSetupSnippet(),
             },
           ],

+ 15 - 0
static/app/gettingStartedDocs/node/express.spec.tsx

@@ -25,6 +25,14 @@ describe('express onboarding docs', function () {
     });
   });
 
+  it('includes error handler', () => {
+    renderWithOnboardingLayout(docs);
+
+    expect(
+      screen.getByText(textWithMarkupMatcher(/Sentry\.setupExpressErrorHandler\(app\)/))
+    ).toBeInTheDocument();
+  });
+
   it('displays sample rates by default', () => {
     renderWithOnboardingLayout(docs, {
       selectedProducts: [
@@ -60,6 +68,13 @@ describe('express onboarding docs', function () {
       selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
     });
 
+    expect(
+      screen.getByText(
+        textWithMarkupMatcher(
+          /const { nodeProfilingIntegration } = require\("@sentry\/profiling-node"\)/
+        )
+      )
+    ).toBeInTheDocument();
     expect(
       screen.getByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
     ).toBeInTheDocument();

Some files were not shown because too many files changed in this diff