add more stats
This commit is contained in:
@@ -32,5 +32,50 @@ export const connectedDispatcher = new promClient.Gauge({
|
||||
},
|
||||
});
|
||||
|
||||
export const totalUsers = new promClient.Gauge({
|
||||
name: "total_users",
|
||||
help: "Counts total users",
|
||||
registers: [promRegister],
|
||||
collect: async () => {
|
||||
const count = await prisma.user.count();
|
||||
totalUsers.set(count);
|
||||
},
|
||||
});
|
||||
|
||||
export const pilotUsers = new promClient.Gauge({
|
||||
name: "pilot_users",
|
||||
help: "Counts pilot users",
|
||||
registers: [promRegister],
|
||||
collect: async () => {
|
||||
const count = await prisma.user.count({
|
||||
where: {
|
||||
permissions: {
|
||||
has: "PILOT",
|
||||
},
|
||||
},
|
||||
});
|
||||
pilotUsers.set(count);
|
||||
},
|
||||
});
|
||||
|
||||
export const dispatcherUsers = new promClient.Gauge({
|
||||
name: "dispatcher_users",
|
||||
help: "Counts dispatcher users",
|
||||
registers: [promRegister],
|
||||
collect: async () => {
|
||||
const count = await prisma.user.count({
|
||||
where: {
|
||||
permissions: {
|
||||
has: "DISPO",
|
||||
},
|
||||
},
|
||||
});
|
||||
dispatcherUsers.set(count);
|
||||
},
|
||||
});
|
||||
|
||||
promRegister.registerMetric(pilotUsers);
|
||||
promRegister.registerMetric(dispatcherUsers);
|
||||
promRegister.registerMetric(totalUsers);
|
||||
promRegister.registerMetric(connectedPilots);
|
||||
promRegister.registerMetric(connectedDispatcher);
|
||||
|
||||
Reference in New Issue
Block a user