-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
src: add --title command line argument, trace event #21477
Conversation
some relevant failures in CI. |
@ofrobots ... when you get a moment, can you take a look at this? It would appear that |
8b9d470
to
51111a8
Compare
doc/node.1
Outdated
@@ -164,6 +164,9 @@ instead of printing to stderr. | |||
.It Fl -throw-deprecation | |||
Throw errors for deprecations. | |||
. | |||
.It Fl -title Ns = Ns Ar title | |||
Specify the process.title on startup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: missing period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove the
doc/api/cli.md
Outdated
added: REPLACEME | ||
--> | ||
|
||
Set the `process.title` on startup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove the
Still exploring why the trace event bit is failing on some of the CI machines.. unable to recreate locally... https://ci.nodejs.org/job/node-test-pull-request/15587/ |
src/node.cc
Outdated
@@ -2813,6 +2817,8 @@ static void ParseArgs(int* argc, | |||
} else if (strncmp(arg, "--security-revert=", 18) == 0) { | |||
const char* cve = arg + 18; | |||
Revert(cve); | |||
} else if (strncmp(arg, "--title=", 8) == 0) { | |||
uv_set_process_title(arg + 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is safe? Setting the process title (which on a lot of OS works by overwriting argv
) while iterating over argv
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly not ;) still verifying and chasing down a few issues that are likely being caused by exactly this problem. I have a change staged locally that moves the actual set_process_title call to after the args are processed but haven't pushed it up to test yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the addition of --title
tied to the trace event things, or is it a convenience thing? It seems like it’s pretty easy already to set the process title from inside the JS code, so it might be okay to leave this out…?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not tied together but the use case is closely related for me. The introduction of --title
is specifically for cases of profiling other users code that I don't exactly want to have to modify just to set the title... using a preload module is a bit overkill for that.
Another CI: https://ci.nodejs.org/job/node-test-pull-request/15613/ This is failing on SmartOS only at this point. |
Simple utility command line argument for setting the process title on process startup.
b8c686b
to
550335e
Compare
Ok, should be good to go now: https://ci.nodejs.org/job/node-test-pull-request/15615/ |
CI is good. One unrelated flaky failure in windows. |
Then it's not quite good yet. :-D |
Let's give it one more shot since the unrelated windows failure happened again https://ci.nodejs.org/job/node-test-pull-request/15676/ |
PR-URL: #21477 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Simple utility command line argument for setting the process title on process startup. PR-URL: #21477 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 6705356 and 9d71619 |
PR-URL: #21477 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Simple utility command line argument for setting the process title on process startup. PR-URL: #21477 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable changes: * console: * The `console.timeLog()` method has been implemented. (#21312) * deps: * Upgrade to libuv 1.22.0. (#21731) * Upgrade to ICU 62.1 (Unicode 11, CLDR 33.1). (#21728) * http: * Added support for passing both `timeout` and `agent` options to `http.request`. (#21204) * napi: * Added experimental support for functions dealing with bigint numbers. (#21226) * process: * The `process.hrtime.bigint()` method has been implemented. (#21256) * Added the `--title` command line argument to set the process title on startup. (#21477) * trace_events: * Added process_name metadata. (#21477)
Notable changes: * console: * The `console.timeLog()` method has been implemented. (#21312) * deps: * Upgrade to libuv 1.22.0. (#21731) * Upgrade to ICU 62.1 (Unicode 11, CLDR 33.1). (#21728) * http: * Added support for passing both `timeout` and `agent` options to `http.request`. (#21204) * napi: * Added experimental support for functions dealing with bigint numbers. (#21226) * process: * The `process.hrtime.bigint()` method has been implemented. (#21256) * Added the `--title` command line argument to set the process title on startup. (#21477) * trace_events: * Added process_name metadata. (#21477) * Added new collaborators * codebytere - Shelley Vohr PR-URL: #21851
Notable changes: * console: * The `console.timeLog()` method has been implemented. (#21312) * deps: * Upgrade to libuv 1.22.0. (#21731) * Upgrade to ICU 62.1 (Unicode 11, CLDR 33.1). (#21728) * http: * Added support for passing both `timeout` and `agent` options to `http.request`. (#21204) * inspector: * Expose the original console API in `require('inspector').console`. (#21659) * napi: * Added experimental support for functions dealing with bigint numbers. (#21226) * process: * The `process.hrtime.bigint()` method has been implemented. (#21256) * Added the `--title` command line argument to set the process title on startup. (#21477) * trace_events: * Added process_name metadata. (#21477) * Added new collaborators * codebytere - Shelley Vohr PR-URL: #21851
Notable changes: * console: * The `console.timeLog()` method has been implemented. (#21312) * deps: * Upgrade to libuv 1.22.0. (#21731) * Upgrade to ICU 62.1 (Unicode 11, CLDR 33.1). (#21728) * http: * Added support for passing both `timeout` and `agent` options to `http.request`. (#21204) * inspector: * Expose the original console API in `require('inspector').console`. (#21659) * napi: * Added experimental support for functions dealing with bigint numbers. (#21226) * process: * The `process.hrtime.bigint()` method has been implemented. (#21256) * Added the `--title` command line argument to set the process title on startup. (#21477) * trace_events: * Added process_name metadata. (#21477) * Added new collaborators * codebytere - Shelley Vohr PR-URL: #21851
Adds a simple utility
--title
command line argument to set the process title on startup. Also, emit theprocess_name
metadata to the trace event log.When emit trace events, the process name appears within the trace event viewer UI:
Changes to
process.title
also appear within the trace_event log:/cc @ofrobots @eugeneo
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes