From 7811124830f5a6cac013a28e3a9cd3fd9d3e0ee7 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 30 Nov 2023 03:38:36 +0000 Subject: [PATCH] log metrics for requests and gcdata --- routes/spec.js | 3 +++ store/buildStatus.js | 12 +++++++++--- util/getGcData.js | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/routes/spec.js b/routes/spec.js index 33a757781..f00c7f3da 100644 --- a/routes/spec.js +++ b/routes/spec.js @@ -1696,6 +1696,9 @@ The OpenDota API offers 50,000 free calls per month and a rate limit of 60 reque } // Count this request redisCount(redis, "request"); + if (req.query.api_key) { + redisCount(redis, "request_api_key"); + } // match details response const match = body.result; return queries.insertMatch( diff --git a/store/buildStatus.js b/store/buildStatus.js index 2077e3ba2..55afe8f0c 100644 --- a/store/buildStatus.js +++ b/store/buildStatus.js @@ -41,15 +41,21 @@ module.exports = function buildStatus(db, redis, cb) { retriever_players_last_day(cb) { utility.getRedisCountDay(redis, "retriever_player", cb); }, - backup_retriever_last_day(cb) { - utility.getRedisCountDay(redis, "backup", cb); - }, + // backup_retriever_last_day(cb) { + // utility.getRedisCountDay(redis, "backup", cb); + // }, parsed_matches_last_day(cb) { utility.getRedisCountDay(redis, "parser", cb); }, + cached_gcdata_last_day(cb) { + utility.getRedisCountDay(redis, "cached_gcdata", cb); + }, requests_last_day(cb) { utility.getRedisCountDay(redis, "request", cb); }, + requests_api_key_last_day(cb) { + utility.getRedisCountDay(redis, "request_api_key", cb); + }, cassandra_repair_last_day(cb) { utility.getRedisCountDay(redis, "cassandra_repair", cb); }, diff --git a/util/getGcData.js b/util/getGcData.js index 9c9a0b2a8..d0e3313b2 100644 --- a/util/getGcData.js +++ b/util/getGcData.js @@ -98,6 +98,7 @@ module.exports = async function getGcData(match, cb) { const gcdata = saved.rows[0]; if (gcdata) { console.log('found cached gcdata for %s', matchId); + redisCount(redis, "cached_gcdata"); return cb(null, gcdata); } getGcDataFromRetriever(match, cb);