Skip to content

@onerepo/plugin-performance-writer

This is a usable example plugin to demonstrate how to build your own telemetry and performance tracing plugin using the oneRepo plugin API and internal performance entries.

Using a PerformanceObserver, it listens for performance marks and converts them into measurements from onerepo_start_ to onerepo_end_ prefixed entries. On CLI shutdown, the measurements will be written to a file for later operation.

Install via npm
npm install --save-dev @onerepo/plugin-performance-writer
performanceWriter(opts): PluginObject

Include the performanceWriter plugin in your oneRepo plugin setup:

onerepo.config.ts
import { performanceWriter } from '@onerepo/plugin-performance-writer';
export default {
plugins: [performanceWriter()],
};
ParameterType
optsOptions
type Options: {
output: "temp" | string;
};

Include the performanceWriter plugin in your oneRepo plugin setup:

onerepo.config.ts
import { performanceWriter } from '@onerepo/plugin-performance-writer';
export default {
plugins: [
performanceWriter({
output: '/tmp/onerepo-perf-out',
}),
],
};
optional output: "temp" | string;

Whether or not to measure performance marks. Adds minimal overhead. Disable if you’d prefer to make your own measurements.

  • temp: Writes a JSON dump of the measurement entries to a temporary file. The filepath will be returned from the run() call of your application.
  • string: Will do the same as 'temp', but use this string as the filepath.
  • Default: true