question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

disableSend env var also disables automatic traces and transactions creation

See original GitHub issue

I have an express nodejs server, and as I’m using webpack, I can’t use the require("elastic-apm-node").start in the runtime code, due to the way webpack traverses the row of the imports.

So, I’m setting env var: ELASTIC_APM_DISABLE_SEND=true. I’m starting the agent using node -r elastic-apm-node/start --unhandled-rejections=strict ./dist/app.js The communication with apm server stops as expected, but the traces and transactions that were previously automatically generated are no longer generated and i loose log correlation.

Expected behavior

I expect the traces and transactions ids to be generated as well, as mentioned in the API docs.

Environment (please complete the following information)

  • OS: Linux
  • Node.js version: 10.13
  • elastic-apm-node: ^3.18.0 Just in case its helpful, I’m using winston, express-winston and @elastic/ecs-winston-format)

How are you starting the agent? (please tick one of the boxes)

  • Calling agent.start() directly (e.g. require('elastic-apm-node').start(...))
  • Requiring elastic-apm-node/start from within the source code
  • Starting node with -r elastic-apm-node/start

Also, something weird that may has to do with the problem, is that to make it work, i start node using node with -r elastic-apm-node/start but also on the top of the file, I have: require("elastic-apm-node/start");. If i remove this line from the top of my entry file executable, the apm automatic traces/transactions etc isn’t working even when i remove the disableSend env var, like it’s never started.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
trentmcommented, Sep 11, 2021

@angelos3lex Thanks very much for the repo. This is just what I need. I’ve made some progress, but I don’t have an answer yet.

0reactions
trentmcommented, Sep 23, 2021

@angelos3lex I’m closing this issue now. Please feel free to re-open if you still have questions or if I’ve missed something. Hopefully using webpack “externals” config is sufficient for your case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

disableSend env var also disables automatic traces and ...
I have an express nodejs server, and as I'm using webpack, I can't use the require("elastic-apm-node").start in the runtime code, due to the...
Read more >
APM and Koa unknown route - APM - Discuss the Elastic Stack
I'm currently using APM (elastic-apm-node 3.18.0), koa, and koa-router on one service. The problem is that even if I give a transaction name ......
Read more >
can you globally disable tracer via an environment variable?
Ah sweet thread. I am also wondering how to disable tracing since DATADOG_TRACE_ENABLED env var does not seem being used in ddtrace library....
Read more >
Basic Options for Bottle | Sentry Documentation
Options that can be read from an environment variable ( SENTRY_DSN , SENTRY_ENVIRONMENT , SENTRY_RELEASE ) are read automatically.
Read more >
Controlling tracing with environment variables - IBM
Specify the directory where trace files are created. This environment variable is optional, except if you are tracing Infoprint Central. If this variable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found