data = mgr.get_counter(daemon_type, daemon_name, stat)[stat]
if data and len(data) > 1:
- return (data[-1][1] - data[-2][1]) / float(data[-1][0] - data[-2][0])
- return 0
+ last_value = data[0][1]
+ last_time = data[0][0]
+ rates = []
+ for datum in data[1:]:
+ rates.append([datum[0], ((datum[1] - last_value) /
+ float(datum[0] - last_time))])
+ last_value = datum[1]
+ last_time = datum[0]
+ return rates
+ return [[0, 0]]
# pylint: disable=too-many-locals,too-many-nested-blocks
def list(self): # pylint: disable=unused-argument
for s in ['rd', 'wr', 'rd_bytes', 'wr_bytes']:
perf_key = "{}{}".format(perf_key_prefix, s)
image['stats'][s] = self._get_rate(
+ 'tcmu-runner', service_id, perf_key)[-1][1]
+ image['stats_history'][s] = self._get_rate(
'tcmu-runner', service_id, perf_key)
- image['stats_history'][s] = mgr.get_counter(
- 'tcmu-runner', service_id, perf_key)[perf_key]
else:
daemon['non_optimized_paths'] += 1
image['non_optimized_paths'].append(hostname)
import { Component } from '@angular/core';
+import { CellTemplate } from '../../../shared/enum/cell-template.enum';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
-import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
import { ListPipe } from '../../../shared/pipes/list.pipe';
import { RelativeDatePipe } from '../../../shared/pipes/relative-date.pipe';
constructor(private tcmuIscsiService: TcmuIscsiService,
cephShortVersionPipe: CephShortVersionPipe,
- dimlessBinaryPipe: DimlessBinaryPipe,
dimlessPipe: DimlessPipe,
relativeDatePipe: RelativeDatePipe,
listPipe: ListPipe) {
},
{
name: 'Read Bytes',
- prop: 'stats.rd_bytes',
- pipe: dimlessBinaryPipe
+ prop: 'stats_history.rd_bytes',
+ cellTransformation: CellTemplate.sparkline
},
{
name: 'Write Bytes',
- prop: 'stats.wr_bytes',
- pipe: dimlessBinaryPipe
+ prop: 'stats_history.wr_bytes',
+ cellTransformation: CellTemplate.sparkline
},
{
name: 'Read Ops',
prop: 'stats.rd',
- pipe: dimlessPipe
+ pipe: dimlessPipe,
+ cellTransformation: CellTemplate.perSecond
},
{
name: 'Write Ops',
prop: 'stats.wr',
- pipe: dimlessPipe
+ pipe: dimlessPipe,
+ cellTransformation: CellTemplate.perSecond
},
{
name: 'A/O Since',
this.tcmuIscsiService.tcmuiscsi().then((resp) => {
this.daemons = resp.daemons;
this.images = resp.images;
+ this.images.map((image) => {
+ image.stats_history.rd_bytes = image.stats_history.rd_bytes.map(i => i[1]);
+ image.stats_history.wr_bytes = image.stats_history.wr_bytes.map(i => i[1]);
+ return image;
+ });
});
}
'rd_bytes': 45.0,
'wr_bytes': 46.0},
'stats_history': {
- 'rd': [[0, 0], [1, 43]],
- 'wr': [[0, 0], [1, 44]],
- 'rd_bytes': [[0, 0], [1, 45]],
- 'wr_bytes': [[0, 0], [1, 46]]}
+ 'rd': [[1, 43]],
+ 'wr': [[1, 44]],
+ 'rd_bytes': [[1, 45]],
+ 'wr_bytes': [[1, 46]]}
}]
})