From ad59909ea3cf12719835829bcc5c113125d649bc Mon Sep 17 00:00:00 2001 From: Johannes Brandenburger <79154528+johannesbrandenburger@users.noreply.github.com> Date: Tue, 23 Jan 2024 10:57:09 +0100 Subject: [PATCH] add analytics counter --- services/analytics-service/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/analytics-service/index.js b/services/analytics-service/index.js index 59bb2f0..a5e0220 100644 --- a/services/analytics-service/index.js +++ b/services/analytics-service/index.js @@ -16,6 +16,7 @@ const database = client.db("reveal-the-world"); // setup collections const analyticsStateCollection = database.collection("analytics"); +const telemetryCollection = database.collection("telemetry"); // start express server const app = express(); @@ -34,6 +35,14 @@ app.get("/:tenant", async (req, res) => { return; } + // add a +1 to the telemetryCollection for the tenant + await telemetryCollection.insertOne({ + tenant: tenant, + timestamp: new Date(), + type: "analytics", + action: "get" + }); + // send the analytics state res.status(200).send(analyticsState); });