Skip to content

Commit 264b265

Browse files
author
OpenShift Bot
authored
Merge pull request #1344 from jmazzitelli/pod-metrics-refer-to-id
Merged by openshift-bot
2 parents de1b459 + 8f2a218 commit 264b265

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

app/scripts/directives/podMetrics.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ angular.module('openshiftConsole')
358358
// get the unit value if specified
359359
var unit = metric.unit || "";
360360

361+
// A typical metric ID is of the form "pod/<pod-id>/custom/<some-endpoint-info>"
362+
// such as "pod/be381d4b-87fc-11e5-b2a3-525400b33d1d/custom/JVM-Heap-Memory-Used".
363+
// We only want part of the metric ID - "custom/" and everything after it.
364+
var datasetId = "custom/" + metric.id.replace(/.*\/custom\//, '');
365+
361366
scope.metrics.push({
362367
label: label,
363368
units: unit,
@@ -366,7 +371,7 @@ angular.module('openshiftConsole')
366371

367372
datasets: [
368373
{
369-
id: "custom/" + metric.name,
374+
id: datasetId,
370375
label: label,
371376
type: metric.type,
372377
data: []

app/scripts/services/metrics.js

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ angular.module("openshiftConsole")
204204
}).then(function(response) {
205205
return _.map(response.data, function(value) {
206206
return {
207+
id: value.id,
207208
name: value.tags.metric_name,
208209
unit: value.tags.units,
209210
description: value.tags.description,

dist/scripts/scripts.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2688,6 +2688,7 @@ params:f
26882688
}).then(function(a) {
26892689
return _.map(a.data, function(a) {
26902690
return {
2691+
id:a.id,
26912692
name:a.tags.metric_name,
26922693
unit:a.tags.units,
26932694
description:a.tags.description,
@@ -11795,14 +11796,14 @@ delete m.alerts[b], L = 1, A();
1179511796
function w() {
1179611797
return window.OPENSHIFT_CONSTANTS.DISABLE_CUSTOM_METRICS ? e.when({}) :j.getCustomMetrics(m.pod).then(function(a) {
1179711798
angular.forEach(a, function(a) {
11798-
var b = a.description || a.name, c = a.unit || "";
11799+
var b = a.description || a.name, c = a.unit || "", d = "custom/" + a.id.replace(/.*\/custom\//, "");
1179911800
m.metrics.push({
1180011801
label:b,
1180111802
units:c,
1180211803
chartPrefix:"custom-" + _.uniqueId("custom-metric-"),
1180311804
chartType:"spline",
1180411805
datasets:[ {
11805-
id:"custom/" + a.name,
11806+
id:d,
1180611807
label:b,
1180711808
type:a.type,
1180811809
data:[]

0 commit comments

Comments
 (0)