https://github.com/wix-incubator/trace-event-lib
A library to create a trace of your JS app per Google's Trace Event format.
https://github.com/wix-incubator/trace-event-lib
chrome-tracing event trace trace-event-format trace-viewer
Last synced: about 1 month ago
JSON representation
A library to create a trace of your JS app per Google's Trace Event format.
- Host: GitHub
- URL: https://github.com/wix-incubator/trace-event-lib
- Owner: wix-incubator
- License: mit
- Created: 2022-06-29T19:41:17.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-06T11:04:34.000Z (about 2 years ago)
- Last Synced: 2025-04-14T18:07:39.917Z (about 1 month ago)
- Topics: chrome-tracing, event, trace, trace-event-format, trace-viewer
- Language: TypeScript
- Homepage: https://wix-incubator.github.io/trace-event-lib/
- Size: 253 KB
- Stars: 3
- Watchers: 43
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trace-event-lib
[](https://badge.fury.io/js/trace-event-lib)
[](https://github.com/wix-incubator/trace-event-lib/actions/workflows/ci.yml)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)A library to create a trace of your JS app per [Google's Trace Event format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU).

These logs can then be visualized with:
* (see the [archive](https://github.com/catapult-project/catapult/tree/master/tracing))
* [Perfetto](https://ui.perfetto.dev) – doesn't support async events, as of 29.06.2022.# Install
```shell
npm install trace-event-lib --save
````# Usage
```javascript
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.
*
* @see {@link AbstractEventBuilder#beginAsync}
* @see {@link AbstractEventBuilder#instantAsync}
* @see {@link AbstractEventBuilder#endAsync}
* @see {@link AbstractEventBuilder#counter}
* @see {@link AbstractEventBuilder#metadata}
* @see {@link AbstractEventBuilder#process_name}
* @see {@link AbstractEventBuilder#process_labels}
* @see {@link AbstractEventBuilder#process_sort_index}
* @see {@link AbstractEventBuilder#thread_name}
* @see {@link AbstractEventBuilder#thread_sort_index}
*/
```## Links
* GH pages:
* Chrome Trace Event format specification:
* Catapult project Wiki (archived):## License
[MIT License](LICENSE)