metrics: add route to query app metrics with the system
This commit is contained in:
+8
-12
@@ -364,23 +364,19 @@ async function readSystemFromGraphite(options) {
|
||||
async function getSystem(options) {
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
const systemStats = await readSystemFromGraphite(options);
|
||||
const result = {};
|
||||
|
||||
const appStats = {};
|
||||
for (const app of await apps.list()) {
|
||||
appStats[app.id] = await getContainer(app.id, options);
|
||||
if (options.system) result.system = await readSystemFromGraphite(options);
|
||||
|
||||
for (const appId of options.appIds) {
|
||||
result[appId] = await getContainer(appId, options);
|
||||
}
|
||||
|
||||
const serviceStats = {};
|
||||
for (const serviceId of await services.listServices()) {
|
||||
serviceStats[serviceId] = await getContainer(serviceId, options);
|
||||
for (const serviceId of options.serviceIds) {
|
||||
result[serviceId] = await getContainer(serviceId, options);
|
||||
}
|
||||
|
||||
return {
|
||||
system: systemStats, // { cpu, memory, swap, block{Read,Write}{Rate,Total}, network{Read,Write}{Rate,Total}
|
||||
apps: appStats,
|
||||
services: serviceStats,
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
async function getSystemStream(options) {
|
||||
|
||||
Reference in New Issue
Block a user