Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
Merge pull request #431 from konstellation-io/fix/resource-metrics
Browse files Browse the repository at this point in the history
fix: resource metrics not working
  • Loading branch information
Gustavo authored Dec 16, 2020
2 parents 20c13a2 + b64e773 commit 784995d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions admin/k8s-manager/prometheus/resourcemetrics/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ func (m *Manager) prometheusQuery(
cpuQuery := fmt.Sprintf(`sum (
max(kube_pod_labels{label_version_name='%s'}) by(label_version_name, pod) * on (pod) group_right(label_version_name)
label_replace(
sum by (pod_name)(
rate(container_cpu_usage_seconds_total{namespace='%s', container_name!="POD",container_name!=""}[5m])*1000
), 'pod', '$1', 'pod_name', '(.+)'
sum by (pod)(
rate(container_cpu_usage_seconds_total{namespace='%s', container!="POD",container!=""}[5m])*1000
), 'pod', '$1', 'pod', '(.+)'
)
) by (label_version_name)`, versionName, namespace)

Expand All @@ -144,9 +144,9 @@ func (m *Manager) prometheusQuery(
memQuery := fmt.Sprintf(`sum (
max(kube_pod_labels{label_version_name='%s'}) by(label_version_name, pod) * on (pod) group_right(label_version_name)
label_replace(
sum by (pod_name)(
container_memory_working_set_bytes{namespace='%s', container_name!="POD",container_name!=""}
), 'pod', '$1', 'pod_name', '(.+)'
sum by (pod)(
container_memory_working_set_bytes{namespace='%s', container!="POD",container!=""}
), 'pod', '$1', 'pod', '(.+)'
)
) by (label_version_name)`, versionName, namespace)

Expand Down
4 changes: 2 additions & 2 deletions admin/k8s-manager/service/resourcemetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ func (r *ResourceMetricsService) GetVersion(
VersionRequest: *req,
}

r.logger.Infof("Getting metrics for version %v", input.VersionRequest)
r.logger.Debugf("Getting metrics for version: %s", input.VersionRequest.String())

metrics, err := r.manager.GetVersionResourceMetrics(input)
if err != nil {
r.logger.Errorf("Error getting metrics: %v", err)
r.logger.Errorf("Error getting metrics: %s", err)
return nil, err
}

Expand Down

0 comments on commit 784995d

Please sign in to comment.