mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
mgr/dashboard: block iSCSI frontend tweaks
Label rates w/ "/s" suffix and switch throughput back to the sparkline graph from dashboard v1. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
9659826875
commit
089920e2c7
@ -15,8 +15,16 @@ class TcmuIscsi(RESTController):
|
||||
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
|
||||
@ -70,9 +78,9 @@ class TcmuIscsi(RESTController):
|
||||
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)
|
||||
|
@ -1,7 +1,7 @@
|
||||
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';
|
||||
@ -21,7 +21,6 @@ export class IscsiComponent {
|
||||
|
||||
constructor(private tcmuIscsiService: TcmuIscsiService,
|
||||
cephShortVersionPipe: CephShortVersionPipe,
|
||||
dimlessBinaryPipe: DimlessBinaryPipe,
|
||||
dimlessPipe: DimlessPipe,
|
||||
relativeDatePipe: RelativeDatePipe,
|
||||
listPipe: ListPipe) {
|
||||
@ -65,23 +64,25 @@ export class IscsiComponent {
|
||||
},
|
||||
{
|
||||
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',
|
||||
@ -96,6 +97,11 @@ export class IscsiComponent {
|
||||
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;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,9 @@ class TcmuIscsiControllerTest(ControllerTestCase):
|
||||
'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]]}
|
||||
}]
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user