@asayerio/tracker-profiler

Tracker plugin for profiling JS function calls

Usage no npm install needed!

<script type="module">
  import asayerioTrackerProfiler from 'https://cdn.skypack.dev/@asayerio/tracker-profiler';
</script>

README

Asayer Tracker profiler plugin

The profiler plugin allows you to measure function performance and capture the arguments and result for each function call.

Installation

npm i @asayerio/tracker-profiler --save

Usage

Initialize the @asayerio/tracker package as usual and load the plugin into it. Then decorate any function inside your code with the generated function.

import Tracker from '@asayerio/tracker';
import trackerProfiler from '@asayerio/tracker-profiler';

const tracker = new Tracker({
  projectID: PROJECT_ID,
});
tracker.start();

export const profiler = tracker.plugin(trackerProfiler());

const fn = profiler('call_name')(() => {
  // ...
}, thisArg); // thisArg is optional