Skip to content
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

util: add node.telemetry trace event category #27975

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented May 30, 2019

At the Collaborator Summit, during the session discussing deprecations,
the concept of adding a mechanism to optionally collect targeted
telemetry data was discussed. This PR introduces one possible way
of doing so while giving users complete opt-in control.

This adds a new node.telemetry trace event category and a new
internal telemetry() function that we can selectively place at
key locations within the code. When the node.telemetry trace
category is enabled, the telemetry() function will emit a
trace event, the key use of which shall just be to determine
how many times a particular code path is used.

For instance,

const { telemetry } = require('util/internal/telemetry');

function someCoreFunction(arg) {
  telemetry('SOME_TRACE_ID', `Path used with arg: ${arg}`);
}

By running node.js with the --trace-event-categories=node.telemetry
flag, the trace event log will include the telemetry entries that
can then be optionally shared with the Node.js project.

The trace event is intentionally very simple.

/cc @addaleax @BridgeAR @Fishrock123

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

At the Collaborator Summit, during the session discussing deprecations,
the concept of adding a mechanism to optionally collect targeted
telemetry data was discussed. This PR introduces one possible way
of doing so while giving users complete opt-in control.

This adds a new `node.telemetry` trace event category and a new
internal `telemetry()` function that we can selectively place at
key locations within the code. When the `node.telemetry` trace
category is enabled, the `telemetry()` function will emit a
trace event, the key use of which shall just be to determine
how many times a particular code path is used.

For instance,

```js
const { telemetry } = require('util/internal/telemetry');

function someCoreFunction(arg) {
  telemetry('SOME_TRACE_ID', `Path used with arg: ${arg}`);
}
```

By running node.js with the `--trace-event-categories=node.telemetry`
flag, the trace event log will include the telemetry entries that
can then be optionally shared with the Node.js project.

The trace event is intentionally very simple.
@jasnell

This comment has been minimized.

1 similar comment
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

@addaleax addaleax added the trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. label Jun 2, 2019
@addaleax
Copy link
Member

addaleax commented Jun 2, 2019

I have a feeling that gathering individual trace events is going to be too heavy for practical telemetry usage, at least for an initial version of it.

@jasnell
Copy link
Member Author

jasnell commented Jun 2, 2019

Entirely possible. I don't want to get overly inventive with this however, and I don't want to cache any data, just output and forget.

@jasnell
Copy link
Member Author

jasnell commented Oct 16, 2019

Closing this for now. Can revisit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants