Initial application generated by JHipster-5.8.2
This commit is contained in:
56
src/main/webapp/app/admin/metrics/metrics.component.html
Normal file
56
src/main/webapp/app/admin/metrics/metrics.component.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<div>
|
||||
<h2>
|
||||
<span id="metrics-page-heading" jhiTranslate="metrics.title">Application Metrics</span>
|
||||
<button class="btn btn-primary float-right" (click)="refresh()">
|
||||
<fa-icon [icon]="'sync'"></fa-icon> <span jhiTranslate="metrics.refresh.button">Refresh</span>
|
||||
</button>
|
||||
</h2>
|
||||
|
||||
<h3 jhiTranslate="metrics.jvm.title">JVM Metrics</h3>
|
||||
<div class="row" *ngIf="!updatingMetrics">
|
||||
<jhi-jvm-memory
|
||||
class="col-md-4"
|
||||
[updating]="updatingMetrics"
|
||||
[jvmMemoryMetrics]="metrics.jvm">
|
||||
</jhi-jvm-memory>
|
||||
<jhi-jvm-threads class="col-md-4" [threadData]="threadData"></jhi-jvm-threads>
|
||||
<jhi-metrics-system
|
||||
class="col-md-4"
|
||||
[updating]="updatingMetrics"
|
||||
[systemMetrics]="metrics.processMetrics">
|
||||
</jhi-metrics-system>
|
||||
</div>
|
||||
|
||||
<div *ngIf="isObjectExisting(metrics, 'garbageCollector')">
|
||||
<h3 jhiTranslate="metrics.jvm.gc.title">Garbage collector statistics</h3>
|
||||
<jhi-metrics-garbagecollector [updating]="updatingMetrics" [garbageCollectorMetrics]="metrics.garbageCollector"></jhi-metrics-garbagecollector>
|
||||
</div>
|
||||
|
||||
<div class="well well-lg" *ngIf="updatingMetrics" jhiTranslate="metrics.updating">Updating...</div>
|
||||
|
||||
<jhi-metrics-request
|
||||
*ngIf="isObjectExisting(metrics, 'http.server.requests')"
|
||||
[updating]="updatingMetrics"
|
||||
[requestMetrics]="metrics['http.server.requests']">
|
||||
</jhi-metrics-request>
|
||||
|
||||
<div >
|
||||
<jhi-metrics-endpoints-requests
|
||||
*ngIf="isObjectExisting(metrics, 'services')"
|
||||
[updating]="updatingMetrics"
|
||||
[endpointsRequestsMetrics]="metrics.services">
|
||||
</jhi-metrics-endpoints-requests>
|
||||
|
||||
<jhi-metrics-cache
|
||||
*ngIf="isObjectExisting(metrics, 'cache')"
|
||||
[updating]="updatingMetrics"
|
||||
[cacheMetrics]="metrics.cache">
|
||||
</jhi-metrics-cache>
|
||||
|
||||
<jhi-metrics-datasource
|
||||
*ngIf="isObjectExistingAndNotEmpty(metrics, 'databases')"
|
||||
[updating]="updatingMetrics"
|
||||
[datasourceMetrics]="metrics.databases">
|
||||
</jhi-metrics-datasource>
|
||||
|
||||
</div>
|
42
src/main/webapp/app/admin/metrics/metrics.component.ts
Normal file
42
src/main/webapp/app/admin/metrics/metrics.component.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
import { JhiMetricsService } from './metrics.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-metrics',
|
||||
templateUrl: './metrics.component.html'
|
||||
})
|
||||
export class JhiMetricsMonitoringComponent implements OnInit {
|
||||
metrics: any = {};
|
||||
threadData: any = {};
|
||||
updatingMetrics = true;
|
||||
JCACHE_KEY: string;
|
||||
|
||||
constructor(private modalService: NgbModal, private metricsService: JhiMetricsService) {
|
||||
this.JCACHE_KEY = 'jcache.statistics';
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
refresh() {
|
||||
this.updatingMetrics = true;
|
||||
this.metricsService.getMetrics().subscribe(metrics => {
|
||||
this.metrics = metrics;
|
||||
this.metricsService.threadDump().subscribe(data => {
|
||||
this.threadData = data.threads;
|
||||
this.updatingMetrics = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
isObjectExisting(metrics: any, key: string) {
|
||||
return metrics && metrics[key];
|
||||
}
|
||||
|
||||
isObjectExistingAndNotEmpty(metrics: any, key: string) {
|
||||
return this.isObjectExisting(metrics, key) && JSON.stringify(metrics[key]) !== '{}';
|
||||
}
|
||||
}
|
11
src/main/webapp/app/admin/metrics/metrics.route.ts
Normal file
11
src/main/webapp/app/admin/metrics/metrics.route.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Route } from '@angular/router';
|
||||
|
||||
import { JhiMetricsMonitoringComponent } from './metrics.component';
|
||||
|
||||
export const metricsRoute: Route = {
|
||||
path: 'jhi-metrics',
|
||||
component: JhiMetricsMonitoringComponent,
|
||||
data: {
|
||||
pageTitle: 'metrics.title'
|
||||
}
|
||||
};
|
18
src/main/webapp/app/admin/metrics/metrics.service.ts
Normal file
18
src/main/webapp/app/admin/metrics/metrics.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { SERVER_API_URL } from 'app/app.constants';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class JhiMetricsService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getMetrics(): Observable<any> {
|
||||
return this.http.get(SERVER_API_URL + 'management/jhi-metrics');
|
||||
}
|
||||
|
||||
threadDump(): Observable<any> {
|
||||
return this.http.get(SERVER_API_URL + 'management/threaddump');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user