appsignal/appsignal-nodejs

Apollo and Mongoose instrumentations not loaded when using esbuild

luismiramirez opened this issue · 3 comments

When running an app built with esbuild, some instrumentation data is missing. The reports we've received and checked show that Mongoose and GraphQL instrumentations don't appear in web requests sent to apps built with esbuild.

Here's a sample from a customer's app:

// package.json

"build": "concurrently \"pnpm:build:*\"",
"build:api": "esbuild src/index.ts --bundle --minify --platform=node --target=node16 --outdir=build --external:@appsignal/nodejs --external:bcrypt",
"build:appsignal": "esbuild src/lib/appsignal.ts --bundle --platform=node --target=node16 --outdir=build/lib --external:@appsignal/nodejs",
"start": "node --require ./build/lib/appsignal.js build/index.js",

To do

  • Update docs for esbuild, that the AppSignal package and all packages we instrument, like prisma, are external packages

I think they may have to mark the dependencies we need to instrument as external to the build as well. That way OpenTelementry can intercept the require calls.

We could ask the user to try adding the frameworks they wish to instrument as external, for example, --external mongoose for Mongoose.

Whatever the outcome of this, we should document what we learn about how to use esbuild with AppSignal.

The user reported back, see linked Intercom issue. Let's update the docs.