openreplay/tracker/tracker-profiler
2021-05-03 13:31:55 +02:00
..
cjs feat: tracker init 2021-05-03 13:31:55 +02:00
src feat: tracker init 2021-05-03 13:31:55 +02:00
.gitignore feat: tracker init 2021-05-03 13:31:55 +02:00
.npmignore feat: tracker init 2021-05-03 13:31:55 +02:00
.prettierrc.json feat: tracker init 2021-05-03 13:31:55 +02:00
LICENSE feat: tracker init 2021-05-03 13:31:55 +02:00
package-lock.json feat: tracker init 2021-05-03 13:31:55 +02:00
package.json feat: tracker init 2021-05-03 13:31:55 +02:00
README.md feat: tracker init 2021-05-03 13:31:55 +02:00
tsconfig-cjs.json feat: tracker init 2021-05-03 13:31:55 +02:00
tsconfig.json feat: tracker init 2021-05-03 13:31:55 +02:00

OpenReplay 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 @openreplay/tracker-profiler

Usage

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

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

const tracker = new Tracker({
  projectKey: YOUR_PROJECT_KEY,
});
tracker.start();

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

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