Skip to content

src: trace_events: support for metadata events - #20757

Closed
ofrobots wants to merge 1 commit into
nodejs:masterfrom
ofrobots:metadata-events
Closed

src: trace_events: support for metadata events#20757
ofrobots wants to merge 1 commit into
nodejs:masterfrom
ofrobots:metadata-events

Conversation

@ofrobots

@ofrobotsofrobots commented May 15, 2018

Copy link
Copy Markdown
Contributor

Add support for metadata events. At this point they are added to the
main buffer. Emit a metadata event for the main thread.

Metadata events are implicitly enabled when tracing is enabled. They contain information pertaining not to the individual events as they occur but rather about the process and the environment. Trace viewers use this information, e.g. to render thread names.

Example:

Before
image

After:
image

/cc @nodejs/trace-events @nodejs/diagnostics

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

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

Copy link
Copy Markdown
Member

Oh, awesome! You just crossed one of my to-do items off!

@mcollinamcollina left a comment

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.

LGTM.

Do we need to document those somewhere?

@jasnell

Copy link
Copy Markdown
Member

@mcollina ... I'll be doing a complete rework of the tracing.md documentation very soon.

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.

Given that trace events can be enabled after this point, perhaps we should move this to ensure that it's always emitted when tracing is first turned on?

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.

fwiw... I plan on doing to same to emit some information about which node.js version is being traced

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Given that trace events can be enabled after this point, perhaps we should move this to ensure that it's always emitted when tracing is first turned on?

I think the right way to go here would be to address the TODO I already added to the code regarding metadata events being kept in a separate buffer of their own and being emitted on each flush of the trace buffer. That would address the case you mention (tracing turned on later) and more (streaming). I think the emit of the event should should stay where it logically make sense. For example, when we create a thread, we should emit the event at that location rather than artificially moving the emit to a point to better align with the lifecycle of tracing.

I plan to implement this secondary buffer for metadata events in a follow-on. I think it will address the issue.

fwiw... I plan on doing to same to emit some information about which node.js version is being traced

👍

@ofrobots

Copy link
Copy Markdown
ContributorAuthor

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 18, 2018
@BridgeAR

BridgeAR commented May 18, 2018

Copy link
Copy Markdown
Member

Running Windows again: https://ci.nodejs.org/job/node-test-commit-windows-fanned/18094/

(All other failures are related due to a bug in our http2 code).

Add support for metadata events. At this point they are added to the
main buffer. Emit a metadata event for the main thread.
@ofrobots

Copy link
Copy Markdown
ContributorAuthor

Thanks. Landed in 3ff723f.

@ofrobots
ofrobots deleted the metadata-events branch May 18, 2018 17:43
ofrobots added a commit that referenced this pull request May 18, 2018
Add support for metadata events. At this point they are added to the
main buffer. Emit a metadata event for the main thread.
PR-URL: #20757
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 22, 2018
Add support for metadata events. At this point they are added to the
main buffer. Emit a metadata event for the main thread.
PR-URL: #20757
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@addaleaxaddaleax mentioned this pull request May 22, 2018
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++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ofrobots@jasnell@BridgeAR@mcollina@nodejs-github-bot