Skip to content

src: add --title command line argument, trace event - #21477

Closed
jasnell wants to merge 2 commits into
nodejs:masterfrom
jasnell:trace-event-data
Closed

src: add --title command line argument, trace event#21477
jasnell wants to merge 2 commits into
nodejs:masterfrom
jasnell:trace-event-data

Conversation

@jasnell

Copy link
Copy Markdown
Member

Adds a simple utility --title command line argument to set the process title on startup. Also, emit the process_name metadata to the trace event log.

$ node --title=foo -pe "process.title"
foo

When emit trace events, the process name appears within the trace event viewer UI:

$ node --title=foo --trace-event-categories node -pe "process.title"
foo

image

Changes to process.title also appear within the trace_event log:

/cc @ofrobots@eugeneo

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jun 22, 2018
@jasnell

Copy link
Copy Markdown
MemberAuthor

@jasnell

Copy link
Copy Markdown
MemberAuthor

some relevant failures in CI.

@jasnell

jasnell commented Jun 23, 2018

Copy link
Copy Markdown
MemberAuthor

@ofrobots ... when you get a moment, can you take a look at this? It would appear that TRACE_STR_COPY() may not be actually be copying for metadata events, but it's difficult to verify.

@jasnelljasnell added the wip Issues and PRs that are still a work in progress. label Jun 23, 2018
Comment threaddoc/node.1 Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: missing period.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove the

Comment threaddoc/api/cli.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove the

@TrottTrott added the semver-minor PRs that contain new features and should be released in the next minor version. label Jun 23, 2018
@jasnell

Copy link
Copy Markdown
MemberAuthor

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/

Comment threadsrc/node.cc Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
MemberAuthor

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

Copy link
Copy Markdown
Member

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…?

@jasnelljasnellJun 25, 2018

Copy link
Copy Markdown
MemberAuthor

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.

@jasnell

Copy link
Copy Markdown
MemberAuthor

@jasnell

Copy link
Copy Markdown
MemberAuthor

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.
@jasnell

Copy link
Copy Markdown
MemberAuthor

Ok, should be good to go now: https://ci.nodejs.org/job/node-test-pull-request/15615/

@addaleaxaddaleax removed the wip Issues and PRs that are still a work in progress. label Jun 25, 2018
@jasnell

Copy link
Copy Markdown
MemberAuthor

CI is good. One unrelated flaky failure in windows.

@Trott

Copy link
Copy Markdown
Member

CI is good. One unrelated flaky failure in windows.

Then it's not quite good yet. :-D

CI: https://ci.nodejs.org/job/node-test-pull-request/15625/

@jasnell

Copy link
Copy Markdown
MemberAuthor

Let's give it one more shot since the unrelated windows failure happened again https://ci.nodejs.org/job/node-test-pull-request/15676/

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 30, 2018
jasnell added a commit that referenced this pull request Jul 11, 2018
PR-URL: #21477
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Jul 11, 2018
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>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in 6705356 and 9d71619

@jasnelljasnell closed this Jul 11, 2018
targos pushed a commit that referenced this pull request Jul 12, 2018
PR-URL: #21477
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request Jul 12, 2018
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>
targos added a commit that referenced this pull request Jul 17, 2018
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)
@targostargos mentioned this pull request Jul 17, 2018
targos added a commit that referenced this pull request Jul 18, 2018
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
targos added a commit that referenced this pull request Jul 18, 2018
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
targos added a commit that referenced this pull request Jul 18, 2018
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
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.semver-minorPRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@jasnell@nodejs-github-bot@Trott@bmeck@addaleax@vsemozhetbyt