Skip to content

Commit b9dc801

Browse files
authored
support comma-separated tag values (#2179)
1 parent 0ac7a6b commit b9dc801

File tree

1 file changed

+17
-5
lines changed
  • spring-boot-admin-server-ui/src/main/frontend/services

1 file changed

+17
-5
lines changed

spring-boot-admin-server-ui/src/main/frontend/services/instance.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,24 @@ class Instance {
6767
}
6868

6969
async fetchMetric(metric, tags) {
70-
const params = tags ? {
71-
tag: Object.entries(tags)
70+
const params = new URLSearchParams();
71+
if (tags) {
72+
let firstElementDuplicated = false;
73+
Object.entries(tags)
7274
.filter(([, value]) => typeof value !== 'undefined' && value !== null)
73-
.map(([name, value]) => `${name}:${value}`)
74-
.join(',')
75-
} : {};
75+
.forEach(([name, value]) => {
76+
params.append('tag', `${name}:${value}`);
77+
78+
if (!firstElementDuplicated) {
79+
// workaround for tags that contains comma
80+
// take a look at https://github.com/spring-projects/spring-framework/issues/23820#issuecomment-543087878
81+
// If there is single tag specified and name or value contains comma then it will be incorrectly split into several parts
82+
// To bypass it we duplicate first tag.
83+
params.append('tag', `${name}:${value}`);
84+
firstElementDuplicated = true;
85+
}
86+
})
87+
}
7688
return this.axios.get(uri`actuator/metrics/${metric}`, {
7789
params
7890
});

0 commit comments

Comments
 (0)