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) {
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) {