import type { PerformanceEntry } from 'node:perf_hooks';
import type { RushConfiguration } from '../api/RushConfiguration';
import type { RushSession } from '../pluginFramework/RushSession';
/**
 * @beta
 */
export interface ITelemetryMachineInfo {
    /**
     * The CPU architecture
     * @example `"AMD64"`
     */
    machineArchitecture: string;
    /**
     * The CPU model
     * * @example `"AMD Ryzen 7 3700X 8-Core Processor"`
     */
    machineCpu: string;
    /**
     * The number of logical CPU cores.
     */
    machineCores: number;
    /**
     * The total amount of RAM on the machine, in MiB.
     */
    machineTotalMemoryMiB: number;
    /**
     * The amount of free RAM on the machine at the end of execution, in MiB.
     */
    machineFreeMemoryMiB: number;
}
/**
 * @beta
 */
export interface ITelemetryOperationResult {
    /**
     * The names of operations that this operation depends on.
     */
    dependencies: string[];
    /**
     * The status code for the operation.
     */
    result: string;
    /**
     * A timestamp in milliseconds (from `performance.now()`) when the operation started.
     * If the operation was blocked, will be `undefined`.
     */
    startTimestampMs?: number;
    /**
     * A timestamp in milliseconds (from `performance.now()`) when the operation finished.
     * If the operation was blocked, will be `undefined`.
     */
    endTimestampMs?: number;
    /**
     * Duration in milliseconds when the operation does not hit cache
     */
    nonCachedDurationMs?: number;
    /**
     * Was this operation built on this machine? If so, the duration can be calculated from `startTimestampMs` and `endTimestampMs`.
     *  If not, you should use the metrics from the machine that built it.
     */
    wasExecutedOnThisMachine?: boolean;
}
/**
 * @beta
 */
export interface ITelemetryData {
    /**
     * Command name
     * @example `"build"`
     */
    readonly name: string;
    /**
     * Duration in seconds
     */
    readonly durationInSeconds: number;
    /**
     * The result of the command
     */
    readonly result: 'Succeeded' | 'Failed';
    /**
     * The millisecond-resolution timestamp of the telemetry logging
     * @example 1648001893024
     */
    readonly timestampMs?: number;
    /**
     * The platform the command was executed on, based on the Node.js `process.platform()` API
     * @example `"darwin"`, `"win32"`, `"linux"`
     */
    readonly platform?: string;
    /**
     * The Rush version
     * @example `5.63.0`
     */
    readonly rushVersion?: string;
    /**
     * Detailed information about the host machine.
     */
    readonly machineInfo?: ITelemetryMachineInfo;
    /**
     * Only applicable to phased commands. Provides detailed results by operation.
     * Keys are operation names, values contain result, timing information, and dependencies.
     */
    readonly operationResults?: Record<string, ITelemetryOperationResult>;
    readonly extraData?: {
        [key: string]: string | number | boolean;
    };
    /**
     * Performance marks and measures collected during the execution of this command.
     * This is an array of `PerformanceEntry` objects, which can include marks, measures, and function timings.
     */
    readonly performanceEntries?: readonly PerformanceEntry[];
}
export declare class Telemetry {
    private _enabled;
    private _store;
    private _dataFolder;
    private _rushConfiguration;
    private _rushSession;
    private _flushAsyncTasks;
    private _telemetryStartTime;
    constructor(rushConfiguration: RushConfiguration, rushSession: RushSession);
    log(telemetryData: ITelemetryData): void;
    flush(): void;
    /**
     * There are some async tasks that are not finished when the process is exiting.
     */
    ensureFlushedAsync(): Promise<void>;
    get store(): ITelemetryData[];
    /**
     * When there are too many log files, delete the old ones.
     */
    private _cleanUp;
    private _getFilePath;
}
//# sourceMappingURL=Telemetry.d.ts.map