UNPKG

@mdf.js/tasks

Version:

MMS - API Core - Tasks

67 lines 2.37 kB
/** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ import { Health } from '@mdf.js/core'; import { Crash, Multi } from '@mdf.js/crash'; import { MetricsDefinitions, PollingGroup } from './types'; export declare class PollingMetricsHandler { private readonly componentId; private readonly resource; private readonly pollingGroup; private readonly cyclesOnStats; private readonly metrics; /** Polling stats */ private readonly pollingStats; /** Scan cycles duration in milliseconds */ private readonly scanCyclesDuration; /** Metrics labels */ private readonly statsLabels; /** Cycle timer */ private cycleTimer; /** * Create a polling stats manager * @param componentId - Component identifier * @param resource - Resource identifier * @param pollingGroup - Polling group assigned to this manager * @param cyclesOnStats - Number of cycles on stats * @param metrics - Metrics instances */ constructor(componentId: string, resource: string, pollingGroup: PollingGroup, cyclesOnStats: number | undefined, metrics: MetricsDefinitions); /** Set the initial point of a cycle */ initializeCycle(): void; /** Set the final point of a cycle */ finalizeCycle(): void; /** * Get the duration of a cycle * @returns Duration of a cycle */ private get duration(); /** * Check if the cycle has overruns and update the metrics * @param duration - Duration of the cycle */ private checkOverruns; /** * Check the duration stats of a cycle * @param duration - Duration of the cycle */ private checkDurationStats; /** * Add a task to the in progress stats * @param taskId - Task identifier */ addTaskInProgress(taskId: string): void; /** * Remove a task from the in progress stats * @param taskId - Task identifier * @param duration - Task duration * @param error - Task error */ removeTaskInProgress(taskId: string, duration?: number, error?: Crash | Multi): void; /** Get health check of the component */ get check(): Health.Check; } //# sourceMappingURL=PollingStatsManager.d.ts.map