diff --git a/backend/src/routes/traffic-flow.ts b/backend/src/routes/traffic-flow.ts index cbf6d44d..f2eba30e 100644 --- a/backend/src/routes/traffic-flow.ts +++ b/backend/src/routes/traffic-flow.ts @@ -19,6 +19,7 @@ import { } from "../services/traffic-flow-settings.js" import { getFlowListenerState, + getFlowRuntimeCounters, purgeTrafficFlowStore, startTrafficFlowListener, listFlowTalkers, @@ -158,7 +159,11 @@ const trafficFlowRoutes: FastifyPluginAsyncZod = async (app) => { reconcile: () => withFlowConfigurationLock(reconcileFlowHost), })) await app.register(createTrafficFlowSettingsRoutes({ - read: () => toTrafficFlowSettingsDto(getFlowListenerState()), + read: async () => { + const settings = await toTrafficFlowSettingsDto(getFlowListenerState()) + const { packetsReceived, lastExporterIp, lastError, lastDatagramAt } = await getFlowRuntimeCounters() + return { ...settings, packetsReceived, lastExporterIp, lastError, lastDatagramAt } + }, update: async patch => { await withFlowConfigurationLock(async () => { const current = await getTrafficFlowSettingsRow() if (agentSocket() && (["collectorIp", "prefix", "flowListenPort", "wgListenPort"] as const).some(key => patch[key] !== undefined && patch[key] !== current[key])) {