From: anurag Date: Wed, 1 Jul 2020 11:27:26 +0000 (+0530) Subject: mgr/dashboard: Remove histogram component X-Git-Tag: v16.1.0~1245^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ff7c7ae40d42392bf9d54f26845751abf48c7ae0;p=ceph.git mgr/dashboard: Remove histogram component This commit is intended for code cleanup of Histogram component. Fixes: https://tracker.ceph.com/issues/26954 Signed-off-by: Aashish Sharma --- diff --git a/qa/tasks/mgr/dashboard/test_osd.py b/qa/tasks/mgr/dashboard/test_osd.py index 0bd3f93f3249..5eea93a9eff1 100644 --- a/qa/tasks/mgr/dashboard/test_osd.py +++ b/qa/tasks/mgr/dashboard/test_osd.py @@ -49,10 +49,7 @@ class OsdTest(DashboardTestCase): def test_details(self): data = self._get('/api/osd/0') self.assertStatus(200) - self.assert_in_and_not_none(data, ['osd_metadata', 'histogram']) - self.assert_in_and_not_none(data['histogram'], ['osd']) - self.assert_in_and_not_none(data['histogram']['osd'], ['op_w_latency_in_bytes_histogram', - 'op_r_latency_out_bytes_histogram']) + self.assert_in_and_not_none(data, ['osd_metadata']) def test_scrub(self): self._post('/api/osd/0/scrub?deep=False') diff --git a/src/pybind/mgr/dashboard/controllers/osd.py b/src/pybind/mgr/dashboard/controllers/osd.py index f8c190d29e9b..6db31c59c72e 100644 --- a/src/pybind/mgr/dashboard/controllers/osd.py +++ b/src/pybind/mgr/dashboard/controllers/osd.py @@ -112,22 +112,11 @@ class Osd(RESTController): """ Returns collected data about an OSD. - :return: Returns the requested data. The `histogram` key may contain a - string with an error that occurred if the OSD is down. + :return: Returns the requested data. """ - try: - histogram = CephService.send_command( - 'osd', srv_spec=svc_id, prefix='perf histogram dump') - except SendCommandError as e: # pragma: no cover - the handling is too obvious - if 'osd down' in str(e): # pragma: no cover - no complexity there - histogram = str(e) - else: # pragma: no cover - no complexity there - raise - return { 'osd_map': self.get_osd_map(svc_id), 'osd_metadata': mgr.get_metadata('osd', svc_id), - 'histogram': histogram, } def set(self, svc_id, device_class): # pragma: no cover diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.e2e-spec.ts index 7b610fb39d41..d539ee891a20 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.e2e-spec.ts @@ -51,7 +51,6 @@ describe('OSDs page', () => { 'Metadata', 'Device health', 'Performance counter', - 'Histogram', 'Performance Details' ]); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts index 909cec861cf5..bf090ab5f8f0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts @@ -36,7 +36,6 @@ import { OsdDevicesSelectionModalComponent } from './osd/osd-devices-selection-m import { OsdFlagsModalComponent } from './osd/osd-flags-modal/osd-flags-modal.component'; import { OsdFormComponent } from './osd/osd-form/osd-form.component'; import { OsdListComponent } from './osd/osd-list/osd-list.component'; -import { OsdPerformanceHistogramComponent } from './osd/osd-performance-histogram/osd-performance-histogram.component'; import { OsdPgScrubModalComponent } from './osd/osd-pg-scrub-modal/osd-pg-scrub-modal.component'; import { OsdRecvSpeedModalComponent } from './osd/osd-recv-speed-modal/osd-recv-speed-modal.component'; import { OsdReweightModalComponent } from './osd/osd-reweight-modal/osd-reweight-modal.component'; @@ -78,7 +77,6 @@ import { TelemetryComponent } from './telemetry/telemetry.component'; ConfigurationComponent, OsdListComponent, OsdDetailsComponent, - OsdPerformanceHistogramComponent, OsdScrubModalComponent, OsdFlagsModalComponent, HostDetailsComponent, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html index bca3f7407156..5755597ed633 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html @@ -50,29 +50,6 @@ -
  • - Histogram - - Histogram not available: {{ osd?.histogram_failed }} - -
    -
    -

    Writes

    - - -
    -
    -

    Reads

    - - -
    -
    -
    -
  • { let component: OsdDetailsComponent; let fixture: ComponentFixture; - let debugElement: DebugElement; - let osdService: OsdService; - let getDetailsSpy: jasmine.Spy; configureTestBed({ imports: [HttpClientTestingModule, NgbNavModule, SharedModule], @@ -27,51 +20,18 @@ describe('OsdDetailsComponent', () => { OsdDetailsComponent, DeviceListComponent, SmartListComponent, - TablePerformanceCounterComponent, - OsdPerformanceHistogramComponent + TablePerformanceCounterComponent ] }); beforeEach(() => { fixture = TestBed.createComponent(OsdDetailsComponent); component = fixture.componentInstance; - component.selection = undefined; - debugElement = fixture.debugElement; - osdService = debugElement.injector.get(OsdService); - - getDetailsSpy = spyOn(osdService, 'getDetails'); - fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); - - it('should fail creating a histogram', () => { - const detailDataWithoutHistogram = { - osd_map: {}, - osd_metadata: {}, - histogram: 'osd down' - }; - getDetailsSpy.and.returnValue(of(detailDataWithoutHistogram)); - component.osd = { tree: { id: 0 } }; - component.refresh(); - expect(getDetailsSpy).toHaveBeenCalled(); - expect(component.osd.histogram_failed).toBe('osd down'); - }); - - it('should succeed creating a histogram', () => { - const detailDataWithHistogram = { - osd_map: {}, - osd_metadata: {}, - histogram: {} - }; - getDetailsSpy.and.returnValue(of(detailDataWithHistogram)); - component.osd = { tree: { id: 0 } }; - component.refresh(); - expect(getDetailsSpy).toHaveBeenCalled(); - expect(component.osd.histogram_failed).toBe(''); - }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts index 21f63d2bb743..99a328908d0e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts @@ -18,7 +18,6 @@ export class OsdDetailsComponent implements OnChanges { osd: { id?: number; details?: any; - histogram_failed?: string; tree?: any; }; grafanaPermission: Permission; @@ -40,11 +39,6 @@ export class OsdDetailsComponent implements OnChanges { refresh() { this.osdService.getDetails(this.osd.id).subscribe((data) => { this.osd.details = data; - this.osd.histogram_failed = ''; - if (!_.isObject(data.histogram)) { - this.osd.histogram_failed = data.histogram; - this.osd.details.histogram = undefined; - } }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.html deleted file mode 100644 index 091cb47f5169..000000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - -
    -
    diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.scss deleted file mode 100644 index 1eb7e6d9c3af..000000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.scss +++ /dev/null @@ -1,10 +0,0 @@ -table { - tr { - height: 10px; - } - - td { - height: 10px; - width: 10px; - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.spec.ts deleted file mode 100644 index 5292f9458f24..000000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { configureTestBed } from '../../../../../testing/unit-test-helper'; -import { OsdPerformanceHistogramComponent } from './osd-performance-histogram.component'; - -describe('OsdPerformanceHistogramComponent', () => { - let component: OsdPerformanceHistogramComponent; - let fixture: ComponentFixture; - - configureTestBed({ - declarations: [OsdPerformanceHistogramComponent] - }); - - beforeEach(() => { - fixture = TestBed.createComponent(OsdPerformanceHistogramComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts deleted file mode 100644 index 44a2f3e05ffb..000000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component, Input, OnChanges } from '@angular/core'; - -import _ from 'lodash'; - -@Component({ - selector: 'cd-osd-performance-histogram', - templateUrl: './osd-performance-histogram.component.html', - styleUrls: ['./osd-performance-histogram.component.scss'] -}) -export class OsdPerformanceHistogramComponent implements OnChanges { - @Input() - histogram: any; - valuesStyle: any; - last = {}; - - ngOnChanges() { - this.render(); - } - - hexdigits(v: number): string { - const i = Math.floor(v * 255).toString(16); - return i.length === 1 ? '0' + i : i; - } - - hexcolor(r: number, g: number, b: number) { - return '#' + this.hexdigits(r) + this.hexdigits(g) + this.hexdigits(b); - } - - render() { - if (!this.histogram) { - return; - } - let max = 0; - - _.each(this.histogram.values, (row, i) => { - _.each(row, (col, j) => { - let val; - if (this.last && this.last[i] && this.last[i][j]) { - val = col - this.last[i][j]; - } else { - val = col; - } - max = Math.max(max, val); - }); - }); - - this.valuesStyle = this.histogram.values.map((row: any, i: number) => { - return row.map((col: any, j: number) => { - const val = this.last && this.last[i] && this.last[i][j] ? col - this.last[i][j] : col; - const g = max ? val / max : 0; - const r = 1 - g; - return { backgroundColor: this.hexcolor(r, g, 0) }; - }); - }); - - this.last = this.histogram.values; - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts index b68aaf1c1935..847b788ee5c6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts @@ -78,7 +78,6 @@ export class OsdService { interface OsdData { osd_map: { [key: string]: any }; osd_metadata: { [key: string]: any }; - histogram: { [key: string]: object }; smart: { [device_identifier: string]: any }; } return this.http.get(`${this.path}/${id}`);