-
Notifications
You must be signed in to change notification settings - Fork 306
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
Traces not flushing on process exit #708
Comments
Note: we are seeing the same thing on our longer-running crons as well so I don't think that the fact that this ran < 1s has anything to do with it. |
Ah I think I may have figured it out. It looks like the Would it be possible to expose a way to manually flush the traces to the agent? Or maybe there is another solution? |
The problem with Is there a way you could change the exit code at runtime and let the process exit gracefully? |
We can update to exit the process gracefully, but I think it is fairly common to exit with |
Exposing the method would not be difficult, and a similar behavior can be achieved by setting the In short, From the Node documentation: Listener functions must only perform synchronous operations. The Node.js process will exit immediately after calling the 'exit' event listeners causing any additional work still queued in the event loop to be abandoned. |
Closing since this is a limitation of how Node handles exit events. |
I'm experiencing the same issue.
@rochdev I tried to just return and set an exit code instead of actually exiting forcefully, i.e. process.exitCode = 1; // instead of process.exit(1) This fixed the issue of @aheuermann have you found a workaround? What I ended up doing was calling a delayed setTimeout(process.exit, 5000); |
@vecerek Sounds like a bug, can you open a new issue that the tracer is preventing the process from exiting? |
From what I understand, what @aheuermann is requesting is a way to access the
|
Describe the bug
We are not seeing traces for our short-lived cron jobs we have added tracing to. These are kubernetes crons. A container is spun up specifically to run the job and then exits once complete or fails. I enabled debug and noticed that traces are being
encoded
but don't seem to be sent to the agent as I do not see anyRequest to the agent
log messages. See logs below:Should the tracer be automatically flushing traces on process exit or is there a way that I can manually flush the traces to the agent upon exit?
Environment
Debian
12.10.0
0.15.3
The text was updated successfully, but these errors were encountered: