@rushstack/heft
Version:
Build all your JavaScript projects the same way: A way that works.
96 lines • 2.78 kB
TypeScript
import { AsyncParallelHook } from 'tapable';
/**
* @public
*/
export interface IMetricsData {
/**
* The command that was executed.
*/
command: string;
/**
* Whether or not the command ran into errors
*/
encounteredError?: boolean;
/**
* The total execution duration of all user-defined tasks from `heft.json`, in milliseconds.
* This metric is for measuring the cumulative time spent on the underlying build steps for a project.
* If running in watch mode, this will be the duration of the most recent incremental build.
*/
taskTotalExecutionMs: number;
/**
* The total duration before Heft started executing user-defined tasks, in milliseconds.
* This metric is for tracking the contribution of Heft itself to total build duration.
*/
bootDurationMs: number;
/**
* How long the process has been alive, in milliseconds.
* This metric is for watch mode, to analyze how long developers leave individual Heft sessions running.
*/
totalUptimeMs: number;
/**
* The name of the operating system provided by NodeJS.
*/
machineOs: string;
/**
* The processor's architecture.
*/
machineArch: string;
/**
* The number of processor cores.
*/
machineCores: number;
/**
* The processor's model name.
*/
machineProcessor: string;
/**
* The total amount of memory the machine has, in megabytes.
*/
machineTotalMemoryMB: number;
/**
* A map of commandline parameter names to their effective values
*/
commandParameters: Record<string, string>;
}
/**
* @public
*/
export interface IHeftRecordMetricsHookOptions {
/**
* @public
*/
metricName: string;
/**
* @public
*/
metricData: IMetricsData;
}
/**
* @internal
*/
export interface IPerformanceData {
taskTotalExecutionMs: number;
encounteredError?: boolean;
}
/**
* @internal
* A simple performance metrics collector. A plugin is required to pipe data anywhere.
*/
export declare class MetricsCollector {
readonly recordMetricsHook: AsyncParallelHook<IHeftRecordMetricsHookOptions>;
private _bootDurationMs;
private _startTimeMs;
/**
* Start metrics log timer.
*/
setStartTime(): void;
/**
* Record metrics to the installed plugin(s).
*
* @param command - Describe the user command, e.g. `start` or `build`
* @param parameterMap - Optional map of parameters to their values
* @param performanceData - Optional performance data
*/
recordAsync(command: string, performanceData?: Partial<IPerformanceData>, parameters?: Record<string, string>): Promise<void>;
}
//# sourceMappingURL=MetricsCollector.d.ts.map