Skip to content

Commit

Permalink
add analytics counter
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesbrandenburger committed Jan 23, 2024
1 parent c7e17d5 commit ad59909
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions services/analytics-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
});
Expand Down

0 comments on commit ad59909

Please sign in to comment.