1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix(gke): port metrics to the backend EE-5447 (#9041)

This commit is contained in:
Dakota Walsh 2023-07-24 12:16:29 +12:00 committed by GitHub
parent e996d29d52
commit 704d70c99b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 441 additions and 247 deletions

View file

@ -3,17 +3,17 @@ import moment from 'moment';
import filesizeParser from 'filesize-parser';
import KubernetesResourceReservationHelper from 'Kubernetes/helpers/resourceReservationHelper';
import { PORTAINER_FADEOUT } from '@/constants';
import { getMetricsForNode } from '@/react/kubernetes/services/service.ts';
class KubernetesNodeStatsController {
/* @ngInject */
constructor($async, $state, $interval, $document, Notifications, KubernetesNodeService, KubernetesMetricsService, ChartService) {
constructor($async, $state, $interval, $document, Notifications, KubernetesNodeService, ChartService) {
this.$async = $async;
this.$state = $state;
this.$interval = $interval;
this.$document = $document;
this.Notifications = Notifications;
this.KubernetesNodeService = KubernetesNodeService;
this.KubernetesMetricsService = KubernetesMetricsService;
this.ChartService = ChartService;
this.onInit = this.onInit.bind(this);
@ -79,7 +79,7 @@ class KubernetesNodeStatsController {
getStats() {
return this.$async(async () => {
try {
const stats = await this.KubernetesMetricsService.getNode(this.state.transition.nodeName);
const stats = await getMetricsForNode(this.$state.params.endpointId, this.state.transition.nodeName);
if (stats) {
const memory = filesizeParser(stats.usage.memory);
const cpu = KubernetesResourceReservationHelper.parseCPU(stats.usage.cpu);
@ -111,7 +111,7 @@ class KubernetesNodeStatsController {
};
try {
const nodeMetrics = await this.KubernetesMetricsService.getNode(this.state.transition.nodeName);
const nodeMetrics = await getMetricsForNode(this.$state.params.endpointId, this.state.transition.nodeName);
if (nodeMetrics) {
const node = await this.KubernetesNodeService.get(this.state.transition.nodeName);