lakutata
Version:
An IoC-based universal application framework.
335 lines (323 loc) • 7.66 kB
TypeScript
import { C as Component } from '../vendor/TypeDef.3.js';
import { C as ComponentOptionsBuilder } from '../vendor/TypeDef.6.js';
import { IntervalHistogram, EventLoopUtilization, PerformanceObserver } from 'node:perf_hooks';
import '../vendor/TypeDef.5.js';
import '../vendor/TypeDef.2.js';
declare const buildAliveMonitorOptions: ComponentOptionsBuilder<{
port: number;
}>;
declare class AliveMonitor extends Component {
protected readonly port: number;
/**
* Initializer
* @protected
*/
protected init(): Promise<void>;
/**
* Destroyer
* @protected
*/
protected destroy(): Promise<void>;
}
interface IMonitor<T> {
statistics: T;
}
interface ICpuMonitorStatistics {
/**
* CPU usage rate occupied by the process (%)
*/
usage: number;
/**
* Minimum CPU usage rate occupied by the process (%)
*/
usageMin: number;
/**
* Maximum CPU usage rate occupied by the process (%)
*/
usageMax: number;
/**
* Average CPU usage rate occupied by the process (%)
*/
usageAvg: number;
/**
* P50 of CPU usage rate occupied by the process (%)
*/
usageP50: number;
/**
* P90 of CPU usage rate occupied by the process (%)
*/
usageP90: number;
/**
* P95 of CPU usage rate occupied by the process (%)
*/
usageP95: number;
/**
* P99 of CPU usage rate occupied by the process (%)
*/
usageP99: number;
}
declare class CpuMonitor extends Component implements IMonitor<ICpuMonitorStatistics> {
get statistics(): ICpuMonitorStatistics;
protected sampleCpuUsage(): Promise<void>;
/**
* Initializer
* @protected
*/
protected init(): Promise<void>;
/**
* Destroyer
* @protected
*/
protected destroy(): Promise<void>;
/**
* Reset statistics
*/
reset(): void;
}
interface IEventLoopMonitorStatistics {
/**
* Minimum event loop delay (ms)
*/
min: number;
/**
* Maximum event loop delay (ms)
*/
max: number;
/**
* Average event loop delay (ms)
*/
avg: number;
/**
* Standard deviation of event loop delay (ms)
*/
stdDev: number;
/**
* P50 of event loop delay (ms)
*/
p50: number;
/**
* P90 of event loop delay (ms)
*/
p90: number;
/**
* P95 of event loop delay (ms)
*/
p95: number;
/**
* P99 of event loop delay (ms)
*/
p99: number;
/**
* Event loop utilization rate (%)
*/
utilRate: number;
}
declare class EventLoopMonitor extends Component implements IMonitor<IEventLoopMonitorStatistics> {
protected readonly histogram: IntervalHistogram;
protected initUtil: EventLoopUtilization;
get statistics(): IEventLoopMonitorStatistics;
/**
* Initializer
* @protected
*/
protected init(): Promise<void>;
/**
* Destroyer
* @protected
*/
protected destroy(): Promise<void>;
/**
* Reset statistics
*/
reset(): void;
}
interface IHttpRequestMonitorStatistics {
/**
* Minimum HTTP request duration (ms)
*/
min: number;
/**
* Maximum HTTP request duration (ms)
*/
max: number;
/**
* Average HTTP request duration (ms)
*/
avg: number;
/**
* Standard deviation of HTTP request duration (ms)
*/
stdDev: number;
/**
* P50 of HTTP request duration (ms)
*/
p50: number;
/**
* P90 of HTTP request duration (ms)
*/
p90: number;
/**
* P95 of HTTP request duration (ms)
*/
p95: number;
/**
* P99 of HTTP request duration (ms)
*/
p99: number;
}
declare class HttpRequestMonitor extends Component implements IMonitor<IHttpRequestMonitorStatistics> {
protected readonly observer: PerformanceObserver;
get statistics(): IHttpRequestMonitorStatistics;
/**
* Initializer
* @protected
*/
protected init(): Promise<void>;
/**
* Destroyer
* @protected
*/
protected destroy(): Promise<void>;
/**
* Reset statistics
*/
reset(): void;
}
interface IMemoryMonitorStatistics {
/**
* Total physical memory (Bytes)
*/
physicalTotal: number;
/**
* Physical memory usage by the process (Bytes)
*/
physicalUsed: number;
/**
* Physical memory usage percentage by the process (%)
*/
physicalUsage: number;
/**
* Minimum physical memory usage by the process (Bytes)
*/
physicalUsedMin: number;
/**
* Maximum physical memory usage by the process (Bytes)
*/
physicalUsedMax: number;
/**
* Average physical memory usage by the process (Bytes)
*/
physicalUsedAvg: number;
/**
* P50 of physical memory usage by the process (Bytes)
*/
physicalUsedP50: number;
/**
* P90 of physical memory usage by the process (Bytes)
*/
physicalUsedP90: number;
/**
* P95 of physical memory usage by the process (Bytes)
*/
physicalUsedP95: number;
/**
* P99 of physical memory usage by the process (Bytes)
*/
physicalUsedP99: number;
/**
* Total heap memory allocated for JS objects (Bytes)
*/
heapTotal: number;
/**
* Used portion of heap memory (Bytes)
*/
heapUsed: number;
/**
* Percentage of used heap memory (%)
*/
heapUsage: number;
/**
* Minimum used portion of heap memory (Bytes)
*/
heapUsedMin: number;
/**
* Maximum used portion of heap memory (Bytes)
*/
heapUsedMax: number;
/**
* Average used portion of heap memory (Bytes)
*/
heapUsedAvg: number;
/**
* P50 of used portion of heap memory (Bytes)
*/
heapUsedP50: number;
/**
* P90 of used portion of heap memory (Bytes)
*/
heapUsedP90: number;
/**
* P95 of used portion of heap memory (Bytes)
*/
heapUsedP95: number;
/**
* P99 of used portion of heap memory (Bytes)
*/
heapUsedP99: number;
/**
* Memory occupied by C++ objects (Bytes)
*/
externalUsed: number;
/**
* Minimum memory occupied by C++ objects (Bytes)
*/
externalUsedMin: number;
/**
* Maximum memory occupied by C++ objects (Bytes)
*/
externalUsedMax: number;
/**
* Average memory occupied by C++ objects (Bytes)
*/
externalUsedAvg: number;
/**
* P50 of memory occupied by C++ objects (Bytes)
*/
externalUsedP50: number;
/**
* P90 of memory occupied by C++ objects (Bytes)
*/
externalUsedP90: number;
/**
* P95 of memory occupied by C++ objects (Bytes)
*/
externalUsedP95: number;
/**
* P99 of memory occupied by C++ objects (Bytes)
*/
externalUsedP99: number;
}
declare class MemoryMonitor extends Component implements IMonitor<IMemoryMonitorStatistics> {
get statistics(): IMemoryMonitorStatistics;
protected sampleMemoryUsage(): void;
/**
* Initializer
* @protected
*/
protected init(): Promise<void>;
/**
* Destroyer
* @protected
*/
protected destroy(): Promise<void>;
/**
* Reset statistics
*/
reset(): void;
}
export { AliveMonitor, CpuMonitor, EventLoopMonitor, HttpRequestMonitor, MemoryMonitor, buildAliveMonitorOptions };
export type { ICpuMonitorStatistics, IEventLoopMonitorStatistics, IHttpRequestMonitorStatistics, IMemoryMonitorStatistics, IMonitor };