mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-26 08:47:36 +08:00
logging daily lb update
This commit is contained in:
parent
532db055b4
commit
1d64387b92
2 changed files with 19 additions and 1 deletions
|
|
@ -21,7 +21,10 @@ import {
|
|||
validateKeys,
|
||||
} from "../../anticheat/index";
|
||||
import MonkeyStatusCodes from "../../constants/monkey-status-codes";
|
||||
import { incrementResult } from "../../utils/prometheus";
|
||||
import {
|
||||
incrementResult,
|
||||
incrementDailyLeaderboard,
|
||||
} from "../../utils/prometheus";
|
||||
import * as George from "../../tasks/george";
|
||||
import { getDailyLeaderboard } from "../../utils/daily-leaderboards";
|
||||
|
||||
|
|
@ -321,6 +324,7 @@ export async function addResult(
|
|||
(user.timeTyping ?? 0) > 7200;
|
||||
|
||||
if (dailyLeaderboard && validResultCriteria) {
|
||||
incrementDailyLeaderboard(result.mode, result.mode2, result.language);
|
||||
dailyLeaderboardRank = await dailyLeaderboard.addResult(
|
||||
{
|
||||
name: user.name,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ const result = new Counter({
|
|||
],
|
||||
});
|
||||
|
||||
const dailyLb = new Counter({
|
||||
name: "daily_leaderboard_update_total",
|
||||
help: "Counts daily leaderboard updates",
|
||||
labelNames: ["mode", "mode2", "language"],
|
||||
});
|
||||
|
||||
const resultLanguage = new Counter({
|
||||
name: "result_language_total",
|
||||
help: "Counts result langauge",
|
||||
|
|
@ -145,6 +151,14 @@ export function incrementResult(
|
|||
resultDuration.observe(res.testDuration);
|
||||
}
|
||||
|
||||
export function incrementDailyLeaderboard(
|
||||
mode: string,
|
||||
mode2: string,
|
||||
language: string
|
||||
): void {
|
||||
dailyLb.inc({ mode, mode2, language });
|
||||
}
|
||||
|
||||
const clientVersionsCounter = new Counter({
|
||||
name: "api_client_versions",
|
||||
help: "Records frequency of client versions",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue