-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
[WIP] process: add process.[start|stop]TracingAgent() #18826
Conversation
Once #18480 land we should have the filename as an optional argument to Suggestion: instead of I'm not that familiar with TracingAgent. Is it possible to have more than one running at the same time? |
Didn't review, but I would prefer this to go in a
I think most of this will answer your questions. |
re: And Ah! I knew there was a previous effort at this but I lost track of where it was. Completely forgot to go look in the node-eps repo :-) |
I'm 👍 in adding a new top level module for this, as it seems the most likely direction we will go for tracing. Another option is to attach them to |
Refamiliarizing myself now with the details of @jasongin's excellent eps write up... and, to be honest, it has a lot more mechanism and complexity than what I think we minimally would need here.
This should be enough of a minimal API to cover the basics. If the vm intrinsic path for actually emitting the events does not pan out we can look at the more complex mechanism later. |
I completely agree. I think the important lessons from that is not in the API but in the capabilities and how that is accomplished. In this case, I think it would be much better to use the I also think it would be better to start and stop the Setting the file destination dynamically also has its unfortunate implications as that won't capture the initial trace events. Thus I think this feature enables an antipattern.
The pushback is in my opinion not about a new top-level module but about a large feature additions. A push back I think is also valid in this case, as we are also in the process of creating a Unified User Defined Tracing Point implementation. That I think should be more thought through before large The concerns about "making it impossible to backport the new mechanism" doesn't really seem valid, as the TSC can decide to make an exception. |
Interesting, ok, I think I can get on board with that. Just to make sure I understand correctly, if the tracing agent is not yet started, using What do you think of the limitation added in this PR that if the command line flag is set, the tracing agent cannot be switched on or off via the API?
I agree to an extent, and yes, there will be events that do not end up being captured. I believe that's a limitation that those using this mechanism would need to just accept given that they have the alternative of launching the process with tracing enabled.
Given that adding a new module is a semver-major, I'm one TSC member who would definitely vote against landing it in an LTS branch simply on the principle that landing semver-major's in an LTS branch simply isn't done unless it's for security purposes. (I do see that @mcollina has at least grabbed the namespace for us tho, just in case) |
If we're bikeshedding API: there should be a way to additively enable or disable categories in order for disparate parts of the application to tweak the tracer without stepping on each other's foot. |
Interesting challenge but I'm not sure it will be possible to prevent accidental trace events making it into the collector unless we want to actively filter on the sink side and support multiple sinks. But being able to "non-destructively" add a category seems like a very worthwhile goal. Minimal would be to have |
Yes. This was essentially what I wanted. |
Just so I'm clear... still writing out to a single target yes? The flow I have in mind is this:
|
My thoughts:
Motivation:
Final thoughts: I think it would be better to think of user-defined tracing points (UDTP) as a whole before pushing a very Making this a |
A few comments on proposed API:
I think a more explicit API has clear start/stop semantics (i.e., a global toggle for turning on/off tracing irrespective of any enabled categories), and enable/disable category semantics (i.e., a way to set the filters on which categories are enabled, no impact on global toggle). |
Ping @jasnell |
@BridgeAR ... still a WIP. Please leave this open. |
Replaced by #19233 |
Work in progress. Do not land. Not ready for CI
Ping @nodejs/diagnostics ...
One of the identified limitations of the v8 trace event support is that it is not currently possible to enable it at runtime. This PR is an attempt to start working towards enabling that capability.
So far it's pretty simple:
If the
--trace-events--enabled
command-line flag is used, then both of these are non-ops that will returnfalse
.There are several key questions:
Is it safe to allow starting and stopping of the tracing agent dynamically like this? Note that starting will cause the existing
node_trace.1.log
to be overwritten each time, just like starting a new trace. We should be able to allow better handling of that once trace_events: add file pattern cli option #18480 lands.Is this the way that we should allow the tracing to be enabled/disabled dynamically at runtime? Is there an alternative that would work better?
There's currently no indication at the JS layer that tracing is enabled or disabled. Does there need to be and what form should that take (simple
process.traceEnabled
flag, perhaps?)Is this barking up the wrong tree entirely? If so, what alternate route should we take?
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
process, trace_events