]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Remove histogram component 34644/head
authoranurag <anurag@localhost.localdomain>
Wed, 1 Jul 2020 11:27:26 +0000 (16:57 +0530)
committerAashish Sharma <aashishsharma@localhost.localdomain>
Thu, 27 Aug 2020 08:40:42 +0000 (14:10 +0530)
This commit is intended for code cleanup of Histogram component.

Fixes: https://tracker.ceph.com/issues/26954
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
12 files changed:
qa/tasks/mgr/dashboard/test_osd.py
src/pybind/mgr/dashboard/controllers/osd.py
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/osds.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.html [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.scss [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts

index 0bd3f93f32495b37b1688fe887b47455c11ef021..5eea93a9eff1e3c721c2948d4b03bab1729d3e44 100644 (file)
@@ -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')
index f8c190d29e9ba50d7319a25d63a836e40d65144c..6db31c59c72edab3af7af75ed22bc95961fb17d4 100644 (file)
@@ -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
index 7b610fb39d4133cc093ee10efb949cb9b994a42b..d539ee891a20b517028f47a5ab34c0932b86d7a8 100644 (file)
@@ -51,7 +51,6 @@ describe('OSDs page', () => {
             'Metadata',
             'Device health',
             'Performance counter',
-            'Histogram',
             'Performance Details'
           ]);
         });
index 909cec861cf58349d0d9932a767fb989e1171658..bf090ab5f8f0b656e91a2c9010a2d25a90a273c5 100644 (file)
@@ -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,
index bca3f7407156d7f60c1a7bbfc44a2480ca83948d..5755597ed6330a2509e3389287c36b0eb4ffcf12 100644 (file)
         </cd-table-performance-counter>
       </ng-template>
     </li>
-    <li ngbNavItem="histogram">
-      <a ngbNavLink
-         i18n>Histogram</a>
-      <ng-template ngbNavContent>
-        <cd-alert-panel *ngIf="osd?.histogram_failed"
-                        type="warning"
-                        i18n>Histogram not available: {{ osd?.histogram_failed }}</cd-alert-panel>
-
-        <div class="row"
-             *ngIf="osd?.details?.histogram">
-          <div class="col-md-6">
-            <h4 i18n>Writes</h4>
-            <cd-osd-performance-histogram [histogram]="osd?.details?.histogram?.osd?.op_w_latency_in_bytes_histogram">
-            </cd-osd-performance-histogram>
-          </div>
-          <div class="col-md-6">
-            <h4 i18n>Reads</h4>
-            <cd-osd-performance-histogram [histogram]="osd?.details?.histogram?.osd?.op_r_latency_out_bytes_histogram">
-            </cd-osd-performance-histogram>
-          </div>
-        </div>
-      </ng-template>
-    </li>
     <li ngbNavItem="performance-details"
         *ngIf="grafanaPermission.read">
       <a ngbNavLink
index 0d55de450ed59ed2654151db3832339a7b7a6017..3272e2bc67941edfd8f3aa776e3f13e637fe3040 100644 (file)
@@ -1,25 +1,18 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { DebugElement } from '@angular/core';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
-import { of } from 'rxjs';
 
 import { configureTestBed } from '../../../../../testing/unit-test-helper';
-import { OsdService } from '../../../../shared/api/osd.service';
 import { SharedModule } from '../../../../shared/shared.module';
 import { TablePerformanceCounterComponent } from '../../../performance-counter/table-performance-counter/table-performance-counter.component';
 import { DeviceListComponent } from '../../../shared/device-list/device-list.component';
 import { SmartListComponent } from '../../../shared/smart-list/smart-list.component';
-import { OsdPerformanceHistogramComponent } from '../osd-performance-histogram/osd-performance-histogram.component';
 import { OsdDetailsComponent } from './osd-details.component';
 
 describe('OsdDetailsComponent', () => {
   let component: OsdDetailsComponent;
   let fixture: ComponentFixture<OsdDetailsComponent>;
-  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('');
-  });
 });
index 21f63d2bb743ca738fb8452cc87629e9ca6b6973..99a328908d0eb5071c6c74e826a4e2c0d6547583 100644 (file)
@@ -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 (file)
index 091cb47..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<table>
-  <tr *ngFor="let row of valuesStyle">
-    <td *ngFor="let col of row"
-        [ngStyle]="col">
-    </td>
-  </tr>
-</table>
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 (file)
index 1eb7e6d..0000000
+++ /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 (file)
index 5292f94..0000000
+++ /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<OsdPerformanceHistogramComponent>;
-
-  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 (file)
index 44a2f3e..0000000
+++ /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;
-  }
-}
index b68aaf1c19351d697e30336ca79ee0550d00c549..847b788ee5c63e36f2adcde936618419d637119d 100644 (file)
@@ -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<OsdData>(`${this.path}/${id}`);