1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 18:59: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

@ -4,10 +4,11 @@ import _ from 'lodash-es';
import filesizeParser from 'filesize-parser';
import KubernetesResourceReservationHelper from 'Kubernetes/helpers/resourceReservationHelper';
import KubernetesPodConverter from 'Kubernetes/pod/converter';
import { getMetricsForPod } from '@/react/kubernetes/services/service.ts';
class KubernetesApplicationStatsController {
/* @ngInject */
constructor($async, $state, $interval, $document, Notifications, KubernetesPodService, KubernetesNodeService, KubernetesMetricsService, ChartService) {
constructor($async, $state, $interval, $document, Notifications, KubernetesPodService, KubernetesNodeService, ChartService) {
this.$async = $async;
this.$state = $state;
this.$interval = $interval;
@ -15,7 +16,6 @@ class KubernetesApplicationStatsController {
this.Notifications = Notifications;
this.KubernetesPodService = KubernetesPodService;
this.KubernetesNodeService = KubernetesNodeService;
this.KubernetesMetricsService = KubernetesMetricsService;
this.ChartService = ChartService;
this.onInit = this.onInit.bind(this);
@ -84,7 +84,7 @@ class KubernetesApplicationStatsController {
getStats() {
return this.$async(async () => {
try {
const stats = await this.KubernetesMetricsService.getPod(this.state.transition.namespace, this.state.transition.podName);
const stats = await getMetricsForPod(this.$state.params.endpointId, this.state.transition.namespace, this.state.transition.podName);
const container = _.find(stats.containers, { name: this.state.transition.containerName });
if (container) {
const memory = filesizeParser(container.usage.memory);
@ -126,7 +126,7 @@ class KubernetesApplicationStatsController {
};
try {
await this.KubernetesMetricsService.getPod(this.state.transition.namespace, this.state.transition.podName);
await getMetricsForPod(this.$state.params.endpointId, this.state.transition.namespace, this.state.transition.podName);
} catch (error) {
this.state.getMetrics = false;
this.state.viewReady = true;