Stats object contains interval attr.

This commit is contained in:
wescoeur 2016-03-30 14:34:37 +02:00
parent 2695941a3c
commit dc0eb76e88

View File

@ -405,19 +405,24 @@ export default class XapiStats {
} }
_getPoints (hostname, step, vmId) { _getPoints (hostname, step, vmId) {
const hostStats = this._hosts[hostname][step]
// Return host points // Return host points
if (vmId === undefined) { if (vmId === undefined) {
return this._hosts[hostname][step] return {
interval: step,
...hostStats
}
} }
const vmsStats = this._vms[hostname][step]
// Return vm points // Return vm points
const points = { endTimestamp: this._hosts[hostname][step].endTimestamp } return {
interval: step,
if (this._vms[hostname][step] !== undefined) { endTimestamp: hostStats.endTimestamp,
points.stats = this._vms[hostname][step][vmId] stats: vmsStats && vmsStats[vmId]
} }
return points
} }
async _getAndUpdatePoints (xapi, host, vmId, granularity) { async _getAndUpdatePoints (xapi, host, vmId, granularity) {