From 691c23f3e620ad1502bb55b7b7f98ee2391c135c Mon Sep 17 00:00:00 2001 From: wphan Date: Wed, 13 Mar 2024 09:53:54 -0400 Subject: [PATCH] add path to cacheHitCounter metric --- src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.ts b/src/index.ts index 634a10c..c54604d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -785,6 +785,7 @@ const main = async (): Promise => { if (topMakers) { cacheHitCounter.add(1, { miss: false, + path: req.baseUrl + req.path, }); res.writeHead(200); res.end(JSON.stringify(topMakers)); @@ -838,6 +839,7 @@ const main = async (): Promise => { topMakers = [...topMakersSet]; cacheHitCounter.add(1, { miss: true, + path: req.baseUrl + req.path, }); res.writeHead(200); res.end(JSON.stringify(topMakers)); @@ -950,6 +952,7 @@ const main = async (): Promise => { if (l2Formatted) { cacheHitCounter.add(1, { miss: false, + path: req.baseUrl + req.path, }); res.writeHead(200); res.end(l2Formatted); @@ -986,6 +989,7 @@ const main = async (): Promise => { cacheHitCounter.add(1, { miss: true, + path: req.baseUrl + req.path, }); res.writeHead(200); res.end(JSON.stringify(l2Formatted)); @@ -1127,6 +1131,7 @@ const main = async (): Promise => { if (l2Formatted) { cacheHitCounter.add(1, { miss: false, + path: req.baseUrl + req.path, }); return l2Formatted; } @@ -1161,6 +1166,7 @@ const main = async (): Promise => { } cacheHitCounter.add(1, { miss: true, + path: req.baseUrl + req.path, }); return l2Formatted; }) @@ -1209,6 +1215,7 @@ const main = async (): Promise => { ) { cacheHitCounter.add(1, { miss: false, + path: req.baseUrl + req.path, }); res.writeHead(200); res.end(redisL3); @@ -1216,6 +1223,7 @@ const main = async (): Promise => { } else { cacheHitCounter.add(1, { miss: true, + path: req.baseUrl + req.path, }); } }