MessageType,
type RequestCommand,
type Statistics,
- type TimeSeries,
+ type TimestampedData,
} from '../types';
import {
CircularArray,
this.statistics.statisticsData.get(entryName).avgTimeMeasurement =
this.statistics.statisticsData.get(entryName).totalTimeMeasurement /
this.statistics.statisticsData.get(entryName).countTimeMeasurement;
- this.statistics.statisticsData.get(entryName)?.timeMeasurementSeries instanceof CircularArray
+ this.statistics.statisticsData.get(entryName)?.measurementTimeSeries instanceof CircularArray
? this.statistics.statisticsData
.get(entryName)
- ?.timeMeasurementSeries?.push({ timestamp: entry.startTime, value: entry.duration })
- : (this.statistics.statisticsData.get(entryName).timeMeasurementSeries =
- new CircularArray<TimeSeries>(Constants.DEFAULT_CIRCULAR_BUFFER_CAPACITY, {
+ ?.measurementTimeSeries?.push({ timestamp: entry.startTime, value: entry.duration })
+ : (this.statistics.statisticsData.get(entryName).measurementTimeSeries =
+ new CircularArray<TimestampedData>(Constants.DEFAULT_CIRCULAR_BUFFER_CAPACITY, {
timestamp: entry.startTime,
value: entry.duration,
}));
this.statistics.statisticsData.get(entryName).medTimeMeasurement = median(
this.extractTimeSeriesValues(
- this.statistics.statisticsData.get(entryName).timeMeasurementSeries
+ this.statistics.statisticsData.get(entryName).measurementTimeSeries
)
);
this.statistics.statisticsData.get(entryName).ninetyFiveThPercentileTimeMeasurement =
nthPercentile(
this.extractTimeSeriesValues(
- this.statistics.statisticsData.get(entryName).timeMeasurementSeries
+ this.statistics.statisticsData.get(entryName).measurementTimeSeries
),
95
);
this.statistics.statisticsData.get(entryName).stdDevTimeMeasurement = stdDeviation(
this.extractTimeSeriesValues(
- this.statistics.statisticsData.get(entryName).timeMeasurementSeries
+ this.statistics.statisticsData.get(entryName).measurementTimeSeries
)
);
if (Configuration.getPerformanceStorage().enabled) {
}
}
- private extractTimeSeriesValues(timeSeries: CircularArray<TimeSeries>): number[] {
+ private extractTimeSeriesValues(timeSeries: CircularArray<TimestampedData>): number[] {
return timeSeries.map((timeSeriesItem) => timeSeriesItem.value);
}
import type { CircularArray } from '../utils';
import type { WorkerData } from '../worker';
-export type TimeSeries = {
+export type TimestampedData = {
timestamp: number;
value: number;
};
-type StatisticsData = {
+type StatisticsData = Partial<{
countRequest: number;
countResponse: number;
countError: number;
countTimeMeasurement: number;
- timeMeasurementSeries: CircularArray<TimeSeries>;
+ measurementTimeSeries: CircularArray<TimestampedData>;
currentTimeMeasurement: number;
minTimeMeasurement: number;
maxTimeMeasurement: number;
medTimeMeasurement: number;
ninetyFiveThPercentileTimeMeasurement: number;
stdDevTimeMeasurement: number;
-};
+}>;
export type Statistics = {
id: string;
uri: string;
createdAt: Date;
updatedAt?: Date;
- statisticsData: Map<string | RequestCommand | IncomingRequestCommand, Partial<StatisticsData>>;
+ statisticsData: Map<string | RequestCommand | IncomingRequestCommand, StatisticsData>;
} & WorkerData;
export { OCPPVersion } from './ocpp/OCPPVersion';
export { PerformanceData } from './orm/entities/PerformanceData';
export { PerformanceRecord } from './orm/entities/PerformanceRecord';
-export type { Statistics, TimeSeries } from './Statistics';
+export type { Statistics, TimestampedData } from './Statistics';
export {
type WSError,
WebSocketCloseEventStatusCode,