mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
Feat 4612 real time metrics for kube nodes (#4708)
* feat(k8s/node): display realtime node metrics GH#4612 * feat(k8s): show observation timestamp instead of real timestamp GH#4612 Co-authored-by: Simon Meng <simon.meng@portainer.io>
This commit is contained in:
parent
45ceece1a9
commit
dc180d85c5
11 changed files with 273 additions and 1 deletions
|
@ -10,6 +10,7 @@ class KubernetesMetricsService {
|
|||
|
||||
this.capabilitiesAsync = this.capabilitiesAsync.bind(this);
|
||||
this.getPodAsync = this.getPodAsync.bind(this);
|
||||
this.getNodeAsync = this.getNodeAsync.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,6 +28,26 @@ class KubernetesMetricsService {
|
|||
return this.$async(this.capabilitiesAsync, endpointID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stats of Node
|
||||
*
|
||||
* @param {string} nodeName
|
||||
*/
|
||||
async getNodeAsync(nodeName) {
|
||||
try {
|
||||
const params = new KubernetesCommonParams();
|
||||
params.id = nodeName;
|
||||
const data = await this.KubernetesMetrics().getNode(params).$promise;
|
||||
return data;
|
||||
} catch (err) {
|
||||
throw new PortainerError('Unable to retrieve node stats', err);
|
||||
}
|
||||
}
|
||||
|
||||
getNode(nodeName) {
|
||||
return this.$async(this.getNodeAsync, nodeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stats
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue