@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 Installationnpm install --save-dev @onerepo/plugin-performance-writeryarn add --dev @onerepo/plugin-performance-writerpnpm install --save-dev @onerepo/plugin-performance-writerConfiguration
Section titled ConfigurationperformanceWriter()
Section titled performanceWriter()function performanceWriter(opts): PluginObject;Defined in: index.ts:46
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 Optionstype Options = { output: 'temp' | string;};Defined in: index.ts:23
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', }), ],};Type declaration
Section titled Type declarationoutput?
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