From dc0eb76e882775e49dc881f85f6c114bd1e1cfae Mon Sep 17 00:00:00 2001 From: wescoeur Date: Wed, 30 Mar 2016 14:34:37 +0200 Subject: [PATCH] Stats object contains interval attr. --- src/xapi-stats.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/xapi-stats.js b/src/xapi-stats.js index 20df6f2a3..83b0b5b69 100644 --- a/src/xapi-stats.js +++ b/src/xapi-stats.js @@ -405,19 +405,24 @@ export default class XapiStats { } _getPoints (hostname, step, vmId) { + const hostStats = this._hosts[hostname][step] + // Return host points if (vmId === undefined) { - return this._hosts[hostname][step] + return { + interval: step, + ...hostStats + } } + const vmsStats = this._vms[hostname][step] + // Return vm points - const points = { endTimestamp: this._hosts[hostname][step].endTimestamp } - - if (this._vms[hostname][step] !== undefined) { - points.stats = this._vms[hostname][step][vmId] + return { + interval: step, + endTimestamp: hostStats.endTimestamp, + stats: vmsStats && vmsStats[vmId] } - - return points } async _getAndUpdatePoints (xapi, host, vmId, granularity) {