GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — trace_events: add more process metadata by jasnell · Pull Request #21785 · nodejs/node

Conversation

@jasnell

@jasnell jasnell commented Jul 12, 2018

Copy link
Copy Markdown
Member

Now that TracedValue has landed, add more detailed
process __metadata including versions, arch, platform,
release detail, and argv/execArgv to the trace event
log.

This adds an entry like:

{
  "pid":46021,
  "tid":46021,
  "ts":4996201438,
  "tts":31331,
  "ph":"M",
  "cat":"__metadata",
  "name":"node",
  "dur":0,
  "tdur":0,
  "args":{
    "process":{
      "versions":{
        "http_parser":"2.8.0",
        "node":"11.0.0-pre",
        "v8":"6.7.288.46-node.14",
        "uv":"1.22.0",
        "zlib":"1.2.11",
        "ares":"1.14.0",
        "modules":"64",
        "nghttp2":"1.32.0",
        "napi":"3",
        "openssl":"1.1.0h"
      },
      "arch":"x64",
      "platform":"linux",
      "release":{
        "name":"node"
      },
      "argv":["./node"],
      "execArgv":["--trace-event-categories","node.perf"]
    }
  }
}
Checklist
  • make -j4 test(UNIX), orvcbuild test` (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@jasnell
trace_events: add more process metadata
e55bab0
Now that TracedValue has landed, add more detailed
process `__metadata` including versions, arch, platform,
release detail, and argv/execArgv to the trace event
log.
@nodejs-github-bot

nodejs-github-bot commented Jul 12, 2018

Copy link
Copy Markdown
Collaborator

@jasnell build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/260/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

jasnell commented Jul 12, 2018

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax reviewed Jul 12, 2018
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

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.

I would really like it if we could avoid the overhead of these calls when tracing is not enabled, especially if this is going to be a more common pattern?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/node_internals.h Outdated
#include "uv.h"
#include "v8.h"
#include "tracing/trace_event.h"
#include "tracing/traced_value.h"

@addaleax addaleax Jul 12, 2018

Copy link
Copy Markdown
Member

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.

Can we include these headers where they are used, rather than (almost) globally?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jasnell jasnell Jul 12, 2018

Copy link
Copy Markdown
Member Author

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.

Sure

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@addaleax addaleax added the trace_events Issues and PRs related to trace events from V8, Node.js core, and user code. label Jul 12, 2018
addaleax
addaleax reviewed Jul 12, 2018
View reviewed changes

@addaleax addaleax left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

I would really like it if we could avoid the overhead of these calls when tracing is not enabled, especially if this is going to be a more common pattern?

Retracting my own review comment: I think I have a good idea for how to do that, let me code that out real quick :)

Edit: No, sorry. My idea was to create a custom kind of smart pointer to use instead of std::unique_ptr<TracedValue>, which would mirror these methods and turn them into no-ops if the handle contained nullptr.

But that requires knowing in advance whether a tracing category is enabled, and I don’t really know how to do that :/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell

jasnell commented Jul 12, 2018

Copy link
Copy Markdown
Member Author

There's a way. The difficulty with metadata events is that they are always implicitly enabled if any tracing at all is enabled. So we would need to separate them out to allow on demand creation. I can work on that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Jul 12, 2018

Copy link
Copy Markdown
Member Author

But that requires knowing in advance whether a tracing category is enabled, and I don’t really know how to do that :/

I'll be pushing a commit in a few minutes... but the way to do this is to attach a v8::TracingController::TraceStateObserver to the TracingController. It will be notified when tracing is enabled/disabled. We can use that as a signal to identify when various categories are dynamically enabled/disabled or when tracing as a whole is enabled. That will allow us to set any state variables we need to determine whether to perform any complex computations or TracedValue building.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell
[Squash] Use a TraceStateObserver
2f37de4
@jasnell

jasnell commented Jul 12, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Ok, @addaleax ... take a look now. I'm using a TraceStateObserver to only output the __metadata events the first time the tracing is enabled. This will mean that the TracedValue for the process metadata is only created the one time when tracing is first enabled. We can use a similar mechanism to selectively enable the building of complex TracedValue instances throughout by implementing a more persistent TraceStateObserver that actively tracks when certain categories are enabled/disabled. This is the same technique that V8 uses internally for exactly this same kind of thing.

Note: by switching to this, just to keep things simple, the process metadata no longer includes the argv and execArgv details since those are not around when the TraceStateObserver is invoked.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell
[Squash] missed a delete
8e2c8c9
@jasnell

jasnell commented Jul 12, 2018

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Jul 13, 2018
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

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.

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@addaleax addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jul 13, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jul 18, 2018
@jasnell @BridgeAR
trace_events: add more process metadata
ededb4b
Now that TracedValue has landed, add more detailed
process `__metadata` including versions, arch, platform,
release detail, and argv/execArgv to the trace event
log.

PR-URL: nodejs#21785
Reviewed-By: Anna Henningsen <[email protected]>
@BridgeAR

BridgeAR commented Jul 18, 2018

Copy link
Copy Markdown
Member

Landed in ededb4b 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR BridgeAR closed this Jul 18, 2018
targos pushed a commit that referenced this pull request Jul 19, 2018
@jasnell @targos
trace_events: add more process metadata
d7edee4
Now that TracedValue has landed, add more detailed
process `__metadata` including versions, arch, platform,
release detail, and argv/execArgv to the trace event
log.

PR-URL: #21785
Reviewed-By: Anna Henningsen <[email protected]>
@targos targos mentioned this pull request Jul 31, 2018
v10.8.0 proposal #22040
Merged
This was referenced Aug 1, 2018
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-nodejs#212
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#223
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#224
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#225
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#226
Closed
2018-08-01 Version 10.8.0 (Current) @targos beevelop/docker-android-nodejs#227
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. trace_events Issues and PRs related to trace events from V8, Node.js core, and user code.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jasnell @nodejs-github-bot @BridgeAR @addaleax
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.