From b6cbf3ea37e5979eb7849d814ef3cf77558307d5 Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Wed, 11 Oct 2023 00:43:24 +0200 Subject: [PATCH] Track PPP --- master/src/routes/master.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/master/src/routes/master.js b/master/src/routes/master.js index ed5109c..7c08dda 100644 --- a/master/src/routes/master.js +++ b/master/src/routes/master.js @@ -15,6 +15,12 @@ const promLatestLatency = new client.Gauge({ labelNames: ['region', 'orchestrator'] }); register.registerMetric(promLatestLatency); +const promLatestPPP = new client.Gauge({ + name: 'orch_latest_ppp', + help: 'Latest price per pixel known for a given Orchestrator', + labelNames: ['region', 'orchestrator'] +}); +register.registerMetric(promLatestPPP); const promLatency = new client.Summary({ name: 'orch_latency', help: 'Summary of latency stats', @@ -122,6 +128,9 @@ masterRouter.post("/collectStats", async (req, res) => { promLatestLatency.set({ region: tag, orchestrator: thisId }, responseTime); promLatency.observe({ region: tag }, responseTime); } + if (discoveryResults && discoveryResults.price_info){ + promLatestPPP.set({ region: tag, orchestrator: thisId }, discoveryResults.price_info.pricePerUnit / discoveryResults.price_info.pixelsPerUnit); + } console.log('received data for ' + thisId + ' from ' + tag + ' (' + responseTime + " ms latency)"); // Save data point const now = new Date().getTime();