Skip to content

make trace-events write to configurable sink #152

Closed

Description

@mike-kaufman

in stateless/paas environments, we want trace-event data to be written to a configurable, arbitrary "sink" (i.e., a stream that can be a socket, file, ...).

  • can configure with an arbitrary file path
  • network socket
  • local shared memory?

For context, at diagnostics summit, we discussed getting "failure" data off of stateless environments in general. We identified three types of data we're interested in:

  • stdout/stderr
  • core dumps
  • trace events

stdout/stderr is configurable by redirecting the stream.
core dumps are configurable via the host environment
This leaves only trace-event data that we want to configure.

Activity

  1. mike-kaufman commented on Feb 20, 2018

    @mike-kaufman
    ContributorAuthor

    some overlap here w/ #163?

  2. AndreasMadsen commented on Feb 20, 2018

    @AndreasMadsen
    Member

    I don’t think so. Trace Events is a provider for our UDTP (user defined tracking point) implementation. The other implementations will have their own sink mechanism (the kernel).

    PS: nodejs/node#18480 will land soon, so that will at least make it possible to write to an arbitrary file.

  3. jasnell commented on May 4, 2018

    @jasnell
    Member

    Quick update on this: @ofrobots and I have been speaking about the possibility of using the inspector protocol to deliver trace events. Some work has already started in this direction with a PR to allow multiple concurrent inspector protocol sessions. There's a bit of work to do here but it should give us a number of solid options.

  4. ofrobots commented on May 4, 2018

    @ofrobots
    Contributor

    Some updates from our side:

    • The tracing domain is part of the Chrome DevTools protocol, but it isn't available in Node just yet – it is implemented in Chrome and @eugeneo has been working on adding the Tracing domain to Node. We expect to open a PR for this shortly.
    • Until recently Node was limited to a single inspector connection. Eugene recently added support for multiple clients to connect to DevTools to consume trace data. This should allow multiple clients to connect to consume trace data.

    Once this is available, it would be fairly straightforward to write clients in JS, or otherwise, to connect and consume data. Here's a small program that I wrote that retrieves trace data. I tested this against Chrome – as node doesn't expose the Tracing domain through the inspector just yet.

    const CDP = require('chrome-remote-interface');
    
    async function main() {
      const client = await CDP();
    
      client.on('event', (message) => {
        console.log(message.method);
      });
    
      let result = await client.Tracing.start({ recordMode: 'recordContinuously', transferMode: 'ReturnAsStream'});
      client.Tracing.tracingComplete(async (params) => {
        const stream = params.stream;
        let eof = false;
        let num = 0;
        while (!eof) {
          const chunk = await client.IO.read({handle: stream, size: 128 * 1024});
          num++;
          console.log(`chunk ${num} eof:`, chunk.eof, 'data:', chunk.data.length);
          eof = chunk.eof;
        }
      });
      setTimeout(() => { client.Tracing.end(); }, 2000);
    }
    
    main().catch(console.error);
  5. mike-kaufman commented on May 4, 2018

    @mike-kaufman
    ContributorAuthor

    Having this data over CDP is really useful, but does it obviate desire to redirect trace events to a file/stream, e.g. via a command-line switch? Consuming CDP may be challenging in PaaS environments, due to network constraints, process constraints, ...

  6. ofrobots commented on May 4, 2018

    @ofrobots
    Contributor

    File output would still be supported.

  7. gireeshpunathil commented on Oct 25, 2019

    @gireeshpunathil
    Member

    should this remain open? [ I am trying to chase dormant issues to closure ]

  8. jasnell commented on Oct 25, 2019

    @jasnell
    Member

    This can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions