]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.ts
import ceph nautilus 14.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / performance-counter.service.ts
CommitLineData
11fdf7f2
TL
1import { HttpClient } from '@angular/common/http';
2import { Injectable } from '@angular/core';
3
4import { of as observableOf } from 'rxjs';
5import { mergeMap } from 'rxjs/operators';
6
81eedcae 7import { cdEncode } from '../decorators/cd-encode';
11fdf7f2
TL
8import { ApiModule } from './api.module';
9
81eedcae 10@cdEncode
11fdf7f2
TL
11@Injectable({
12 providedIn: ApiModule
13})
14export class PerformanceCounterService {
15 private url = 'api/perf_counters';
16
17 constructor(private http: HttpClient) {}
18
19 list() {
20 return this.http.get(this.url);
21 }
22
23 get(service_type: string, service_id: string) {
81eedcae 24 return this.http.get(`${this.url}/${service_type}/${service_id}`).pipe(
11fdf7f2
TL
25 mergeMap((resp) => {
26 return observableOf(resp['counters']);
27 })
28 );
29 }
30}