From ce8af5a8776db1405d3e514bc1bf5fb01c5adf6e Mon Sep 17 00:00:00 2001 From: Kurbanov Bulat Date: Wed, 16 Feb 2022 19:04:07 +0300 Subject: [PATCH] Add requests counter --- src/analytics/users_counter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/analytics/users_counter.ts b/src/analytics/users_counter.ts index dbf3440..2b32fb5 100644 --- a/src/analytics/users_counter.ts +++ b/src/analytics/users_counter.ts @@ -1,6 +1,7 @@ export default class UsersCounter { static bots: {[key: string]: Set} = {}; static allUsers: Set = new Set(); + static requests = 0; static take(userId: number, bot: string) { const isExists = this.bots[bot]; @@ -11,6 +12,7 @@ export default class UsersCounter { this.bots[bot].add(userId); this.allUsers.add(userId); + this.requests++; } static getAllUsersCount(): number { @@ -29,6 +31,7 @@ export default class UsersCounter { const lines = []; lines.push(`all_users_count ${this.getAllUsersCount()}`); + lines.push(`requests_count ${this.requests}`); const usersByBots = this.getUsersByBots();