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

Superfluous log messages #2352

Closed
tbglazer opened this issue Sep 28, 2021 · 4 comments
Closed

Superfluous log messages #2352

tbglazer opened this issue Sep 28, 2021 · 4 comments
Assignees
Labels
agent-nodejs Make available for APM Agents project planning.

Comments

@tbglazer
Copy link

I'm not sure if its an issue or I'm missing something : it connects to the server and works fine only the logger when in debug
displays every 30 seconds two log messages as shown in the picture (I added a stack trace in http-shared)

elastic

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Sep 28, 2021
@trentm
Copy link
Member

trentm commented Sep 28, 2021

Hi, @tbglazer. What version of elastic-apm-node are you using? There have been some recentish changes that could affect this.

@trentm
Copy link
Member

trentm commented Sep 28, 2021

Actually, more specifically, what is the output of running:

npm ls elastic-apm-http-client

in your "C:\git\Snifit" directory? From the line numbers in your stacktrace, my guess is that you have elastic-apm-http-client@9.8.1. In the next version of that package, a fix was added to ensure that the APM agent did not try to trace its own communications: https://github.com/elastic/apm-nodejs-http-client/blob/master/CHANGELOG.md#v990

The two superfluous log lines you are seeing are instrumentation of the APM agent making its own http request to APM server to report collected trace data. If you upgrade to the latest 'elastic-apm-node' you should get a more recent version of its 'elastic-apm-http-client' dependency to get this fix.

Please let me know if that works for you.

@trentm trentm self-assigned this Sep 28, 2021
@trentm trentm added this to Planned in APM-Agents (OLD) via automation Sep 28, 2021
@trentm trentm moved this from Planned to In Progress in APM-Agents (OLD) Sep 28, 2021
@trentm trentm moved this from In Progress to Blocked in APM-Agents (OLD) Sep 30, 2021
@tbglazer
Copy link
Author

tbglazer commented Oct 1, 2021

Thanks Mick for your help I did the update and it works fine without extra messages.
I have a question not related to the log messages : do you have any intentions to make it work in webpack ?
Our company has a node process that is intended to run on the workstations and deploying the code as webpack
is most convenient in this case.
I found two workarounds on the net one as a webpack plugin and the other that is fiddling with the require-in-the-middle
code but none of them ended up to work for me.

@trentm
Copy link
Member

trentm commented Oct 1, 2021

@tbglazer Regarding webpack: I'll quote some comments I made when recently looking into this a little bit.

[From https://github.com//issues/2318#issuecomment-919364997]

The general advice for webpack + APM usage (not just for Elastic's APM, but for others as well) is to use the webpack-node-externals package to exclude everything under node_modules/... (or at the least the agent, the ecs-logging lib, and any packages you want traced) from the bundled "dist/app.js". This may or may not defeat the purpose of using webpack for you.
...
ultimately getting tracing to work properly requires not bundling modules to be traced (as mentioned above), or someone getting deeply involved into webpack internals to see if it is possible to hook into __webpack_require__ or similar (as is mentioned briefly here in a require-in-the-middle issue).

Our APM agent docs are somewhat lacking in advice here. I have #1967 opened on me to improve those docs (and possibly see if there are some improvements that can be made in the agent to make it easier) for using the APM agent with bundlers like webpack.

(I'm going to close this, because the original issue has been answered. If you have more questions about webpack or otherwise, please feel free to open a new issue or discussion on #1967.)

@trentm trentm closed this as completed Oct 1, 2021
APM-Agents (OLD) automation moved this from Blocked to Done Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
Development

No branches or pull requests

2 participants