Added command counts to Prometheus metrics
This commit is contained in:
parent
d0a4addcb5
commit
e5d9388952
4 changed files with 21 additions and 11 deletions
7
shard.js
7
shard.js
|
@ -85,6 +85,8 @@ connected_workers ${image.connections.length}
|
|||
# TYPE queued_jobs gauge
|
||||
# HELP max_jobs Number of max allowed jobs on this worker
|
||||
# TYPE max_jobs gauge
|
||||
# HELP command_count Number of times a command has been run
|
||||
# TYPE command_count counter
|
||||
`);
|
||||
const servers = await image.getStatus();
|
||||
for (const [i, w] of servers.entries()) {
|
||||
|
@ -92,6 +94,10 @@ connected_workers ${image.connections.length}
|
|||
res.write(`queued_jobs{worker="${i}"} ${w.queued}\n`);
|
||||
res.write(`max_jobs{worker="${i}"} ${w.max}\n`);
|
||||
}
|
||||
const counts = await database.getCounts();
|
||||
for (const [i, w] of Object.entries(counts)) {
|
||||
res.write(`command_count{command="${i}"} ${w}\n`);
|
||||
}
|
||||
res.end();
|
||||
});
|
||||
httpServer.listen(process.env.METRICS, () => {
|
||||
|
@ -146,7 +152,6 @@ connected_workers ${image.connections.length}
|
|||
if (result) return this.ipc.broadcast("reloadFail", { result: result });
|
||||
const result2 = await handler.load(collections.paths.get(message.cmd));
|
||||
if (result2) return this.ipc.broadcast("reloadFail", { result: result2 });
|
||||
//return this.ipc.broadcast("reloadSuccess", this.clusterID);
|
||||
return this.ipc.broadcast("reloadSuccess");
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue