Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Replace Heapster with Metrics API (#177)
Browse files Browse the repository at this point in the history
* Replace Heapster with Metrics API call

* Add `n` factor

Metrics API likes to report CPU usage in `n`-suffixed units, so make
sure its represented correctly.
  • Loading branch information
wms authored and hjacobs committed Nov 3, 2018
1 parent 1fdf205 commit 384ea8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/src/utils.js
@@ -1,6 +1,7 @@
const PIXI = require('pixi.js')

const FACTORS = {
'n': 1 / 1000 / 1000 / 1000,
'm': 1 / 1000,
'K': 1000,
'M': Math.pow(1000, 2),
Expand Down
4 changes: 2 additions & 2 deletions kube_ops_view/kubernetes.py
Expand Up @@ -101,7 +101,7 @@ def query_kubernetes_cluster(cluster):
unassigned_pods[pod_key] = obj

try:
response = request(cluster, '/api/v1/namespaces/kube-system/services/heapster/proxy/apis/metrics/v1alpha1/nodes')
response = request(cluster, '/apis/metrics.k8s.io/v1beta1/nodes')
response.raise_for_status()
data = response.json()
if not data.get('items'):
Expand All @@ -112,7 +112,7 @@ def query_kubernetes_cluster(cluster):
except Exception as e:
logger.warning('Failed to query node metrics {}: {}'.format(cluster.id, get_short_error_message(e)))
try:
response = request(cluster, '/api/v1/namespaces/kube-system/services/heapster/proxy/apis/metrics/v1alpha1/pods')
response = request(cluster, '/apis/metrics.k8s.io/v1beta1/pods')
response.raise_for_status()
data = response.json()
if not data.get('items'):
Expand Down

0 comments on commit 384ea8f

Please sign in to comment.