@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.
Installation
Section titled “Installation”npm install --save-dev @onerepo/plugin-performance-writeryarn add --dev @onerepo/plugin-performance-writerpnpm install --save-dev @onerepo/plugin-performance-writerConfiguration
Section titled “Configuration”performanceWriter()
Section titled “performanceWriter()”function performanceWriter(opts): PluginObject;Include the performanceWriter plugin in your oneRepo plugin setup:
import { performanceWriter } from '@onerepo/plugin-performance-writer';
export default { plugins: [performanceWriter()],};Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts | Options |
Options
Section titled “Options”type Options = { output?: 'temp' | string;};Include the performanceWriter plugin in your oneRepo plugin setup:
import { performanceWriter } from '@onerepo/plugin-performance-writer';
export default { plugins: [ performanceWriter({ output: '/tmp/onerepo-perf-out', }), ],};Properties
Section titled “Properties”output?
Section titled “output?”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 therun()call of your application.string: Will do the same as'temp', but use this string as the filepath.- Default:
true