fix: fix performance statistics formatting in log messages
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Feb 2024 17:46:28 +0000 (18:46 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Feb 2024 17:46:28 +0000 (18:46 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/performance/PerformanceStatistics.ts
src/types/index.ts

index 88bb29d04d97d9aa315df258dc0923334d803d1e..3bb72ffa5f711b2b6c3c2af6d3e2501454503f45 100644 (file)
@@ -14,6 +14,7 @@ import {
   MessageType,
   type RequestCommand,
   type Statistics,
+  type StatisticsData,
   type StorageConfiguration,
   type TimestampedData
 } from '../types/index.js'
@@ -204,7 +205,9 @@ export class PerformanceStatistics {
   private logStatistics (): void {
     logger.info(this.logPrefix(), {
       ...this.statistics,
-      statisticsData: JSONStringifyWithMapSupport(this.statistics.statisticsData)
+      statisticsData: JSON.parse(
+        JSONStringifyWithMapSupport(this.statistics.statisticsData)
+      ) as Map<string | RequestCommand | IncomingRequestCommand, StatisticsData>
     })
   }
 
index 6cf5be57f5a658488da3c305a754f8f76920b07d..2b17daa55f639c13995c854d866084cd7dbd525d 100644 (file)
@@ -262,7 +262,7 @@ export type {
 export { OCPP20OptionalVariableName } from './ocpp/2.0/Variables.js'
 export { OCPPVersion } from './ocpp/OCPPVersion.js'
 export { PerformanceRecord } from './orm/entities/PerformanceRecord.js'
-export type { Statistics, TimestampedData } from './Statistics.js'
+export type { Statistics, StatisticsData, TimestampedData } from './Statistics.js'
 export {
   type WSError,
   WebSocketCloseEventStatusCode,