event-loop-delay-check
Advanced tools
Comparing version 0.0.6 to 0.0.7
export type EluMonitorServiceOptions = { | ||
checkIntervalMs?: number; | ||
criticalThreshold?: number; | ||
criticalDelayMs: number; | ||
statusCheckCallback?: (isCritical: boolean, eluUtilization: number) => void; | ||
@@ -5,0 +6,0 @@ }; |
@@ -8,6 +8,7 @@ import { IEventLoopCheckService } from '../event-loop-check/event-loop-check.interface'; | ||
private _criticalThreshold; | ||
private _criticalDelayMs; | ||
private _checkIntervalMs; | ||
private _statusCheckCallback?; | ||
private _isCriticalStatus; | ||
setConfig({ criticalThreshold, statusCheckCallback, checkIntervalMs }: EluMonitorServiceOptions): void; | ||
setConfig({ criticalThreshold, statusCheckCallback, checkIntervalMs, criticalDelayMs, }: EluMonitorServiceOptions): void; | ||
create(): void; | ||
@@ -14,0 +15,0 @@ destroy(): void; |
@@ -9,7 +9,9 @@ "use strict"; | ||
this._criticalThreshold = 90; | ||
this._criticalDelayMs = 5000; | ||
this._checkIntervalMs = 500; | ||
this._isCriticalStatus = false; | ||
} | ||
setConfig({ criticalThreshold, statusCheckCallback, checkIntervalMs }) { | ||
setConfig({ criticalThreshold, statusCheckCallback, checkIntervalMs, criticalDelayMs, }) { | ||
this._criticalThreshold = criticalThreshold ?? this._criticalThreshold; | ||
this._criticalDelayMs = criticalDelayMs ?? this._criticalDelayMs; | ||
this._checkIntervalMs = Math.max(checkIntervalMs ?? this._checkIntervalMs); | ||
@@ -32,5 +34,7 @@ this._statusCheckCallback = statusCheckCallback; | ||
const eluUtilizations = this._eventLoopDelayCheckService.getEventLoopUtilizations(); | ||
const isCritical = eluUtilizations > this._criticalThreshold; | ||
this._isCriticalStatus = isCritical; | ||
this?._statusCheckCallback(isCritical, eluUtilizations); | ||
const eluDelay = this._eventLoopDelayCheckService.getEventLoopDelay(); | ||
const isCriticalThreshold = eluUtilizations > this._criticalThreshold; | ||
const isCriticalDelay = eluDelay > this._criticalDelayMs; | ||
this._isCriticalStatus = isCriticalThreshold && isCriticalDelay; | ||
this?._statusCheckCallback(isCriticalThreshold, eluUtilizations); | ||
} | ||
@@ -37,0 +41,0 @@ } |
{ | ||
"name": "event-loop-delay-check", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Check the event loop delay", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/unrealmanu/event-loop-delay-check", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24249
327