@wix-incubator/trace-event-lib

trace-event-lib

npm version CI semantic-release: angular Commitizen friendly

A library to create a trace of your JS app per Google's Trace Event format.

chrome://tracing example

These logs can then be visualized with:

Install

npm install trace-event-lib --save

Usage

import { AbstractEventBuilder } from 'chrome-trace-event';

class ConcreteEventBuilder extends AbstractEventBuilder {
send(event) {
// Implement the abstract method: push events into a stream, array, etc.
}
}

const trace = new ConcreteEventBuilder();

trace.begin({ cat: 'category1,category2', name: 'duration event' });
// ...
trace.instant({ name: 'resolve config', args: { /* ... */ } });
// ...
trace.complete({ name: 'nested event', dur: 3e6 /* 3s */ });
// ...
trace.end();

/**
* Also, see the other methods on the website.
*
*