Skip to content

Commit

Permalink
log metrics for requests and gcdata
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Nov 30, 2023
1 parent 71ad1ca commit 7811124
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions routes/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 9 additions & 3 deletions store/buildStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
1 change: 1 addition & 0 deletions util/getGcData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7811124

Please sign in to comment.