-
Notifications
You must be signed in to change notification settings - Fork 227
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
integrate with Nuxtjs but cannot see any transaction in APM #4143
Comments
@cwhsu1984 Hi. Thanks for the issue. There are a few things to note here, but ultimately, this APM agent is not currently able to instrument NuxtJS 3 apps. instrumenting the dev server (somewhat)I created a basic Nuxt 3 app using the getting started doc: https://nuxt.com/docs/getting-started/introduction I was able to get some tracing data for HTTP requests to the server when using the dev server:
Then I would get traces something like the following (this is a text-based summary of traces rather than showing screenshots from Kibana):
These transactions and spans are coming from automatic instrumentation of the This tracing is, of course, limited because the APM agent ( No tracing for the production serverWhen I build and run the production (non-dev) server:
This does not work. Ideally we would be able to get some instrumentation of the ESM code by using the additional
This partially works. For example, when manually making a call to just the added "/api/hello" endpoint in my small Nuxt app:
I successfully get a trace from the APM agent:
However, when loading the full app in a browser (http://localhost:3000), I get a 500 error in the browser and this in the app log:
This is almost certainly a bug in the underlying library that the APM agent is using to hook into ES module imports. That hooking is breaking the BundlingFinally, if I understand correctly, the built server code uses a bundler (esbuild?). Currently this APM agent does not support instrumenting libraries used in bundled code. Node.js core libraries (like If you are mainly interested in HTTP incoming and outgoing spans, then this may be fine for you. optionsI have not tried this, but perhaps the Nuxt tsconfig could be changed to build a CommonJS server, rather than ESM code. Then that might allow the built server to be instrumented without the |
I would like to thank you for the very detailed response to the thread. |
Okay, thanks. I'll close this issue now. Please feel free to re-open, or create a new one if you have other questions. I'm sorry this doesn't work out of the box for you. |
Actually this exact issue was just recently fixed in import-in-the-middle: nodejs/import-in-the-middle#139
|
It looks like that particular crash will be fixed when we have a release with this update: #4162 |
I'm not sure exactly how I should apply this, so this is what I did.
Still the same error.
|
@cwhsu1984 Sorry to imply that we had a release with that fix. We do not yet have a release of this APM agent with the update to the import-in-the-middle library that you need. |
Is there a timeline or schedule date for the next release? |
This should fix the issue being hit here: #4143 (comment)
This should fix the issue being hit here: #4143 (comment)
This should fix the issue being hit here: #4143 (comment)
@cwhsu1984 There is now a v4.7.3 release that has a fix for that particular issue from #4143 (comment) (Note again, to set expectations, that instrumentation of a Nuxtjs app possibly using ESM and bundling, will be limited. Of course the APM agent should never cause the app to crash.) |
Thanks for the info again.
|
This should fix the issue being hit here: elastic#4143 (comment)
This is how I init apm in Dockerfile.
CMD node -r ./server/node_modules/elastic-apm-node/start.js ./server/index.mjs
This is the env config, and we run containers in kubernetes.
I check the service in APM, but there is no data.
But If I look at Metrics tab, the cpu and memory related info is collected
Below is the container log. And I suspect it's due to the message "no active transaction found - cannot build new span".
I already try to adjust ELASTIC_APM_TRACE_CONTINUATION_STRATEGY into different settings, but still no luck.
What is the possible cause of this?
Any suggestion on how to debug this?
The text was updated successfully, but these errors were encountered: