Skip to content

Commit f751359

Browse files
committed
Show warning for non-supported boot 1.x in metrics
1 parent ccd0ca9 commit f751359

File tree

2 files changed

+27
-8
lines changed
  • spring-boot-admin-server-ui/src/main/frontend/views/instances

2 files changed

+27
-8
lines changed

spring-boot-admin-server-ui/src/main/frontend/views/instances/auditevents/index.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
<p v-text="error.message"/>
2727
</div>
2828
</div>
29+
<div v-if="isOldAuditevents" class="message is-warning">
30+
<div class="message-body">
31+
<p>Audit Log is not supported for Spring Boot 1.x applications.</p>
32+
</div>
33+
</div>
2934
<auditevents-list v-if="events" :instance="instance" :events="events"/>
3035
</div>
3136
</section>
@@ -79,6 +84,7 @@
7984
hasLoaded: false,
8085
error: null,
8186
events: null,
87+
isOldAuditevents: false
8288
}),
8389
methods: {
8490
async fetchAuditevents() {
@@ -104,7 +110,11 @@
104110
error: error => {
105111
vm.hasLoaded = true;
106112
console.warn('Fetching audit events failed:', error);
107-
vm.error = error;
113+
if (error.response.headers['content-type'].includes('application/vnd.spring-boot.actuator.v2')) {
114+
vm.error = error;
115+
} else {
116+
vm.isOldAuditevents = true;
117+
}
108118
}
109119
});
110120
},

spring-boot-admin-server-ui/src/main/frontend/views/instances/metrics/index.vue

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@
2626
<p v-text="error.message"/>
2727
</div>
2828
</div>
29-
30-
<form @submit.prevent="handleSubmit" class="field">
31-
<div class="field" v-if="availableMetrics.length > 0">
29+
<div v-if="isOldMetrics" class="message is-warning">
30+
<div class="message-body">
31+
<p>Metrics are not supported for Spring Boot 1.x applications.</p>
32+
</div>
33+
</div>
34+
<form @submit.prevent="handleSubmit" class="field" v-else-if="availableMetrics.length > 0">
35+
<div class="field">
3236
<div class="control">
3337
<div class="select">
3438
<select v-model="selectedMetric">
@@ -116,7 +120,8 @@
116120
selectedMetric: null,
117121
stateFetchingTags: null,
118122
availableTags: null,
119-
selectedTags: null
123+
selectedTags: null,
124+
isOldMetrics: false
120125
}),
121126
created() {
122127
this.fetchMetricIndex();
@@ -179,9 +184,13 @@
179184
this.error = null;
180185
try {
181186
const res = await this.instance.fetchMetrics();
182-
this.availableMetrics = res.data.names;
183-
this.availableMetrics.sort();
184-
this.selectedMetric = this.availableMetrics[0];
187+
if (res.headers['content-type'].includes('application/vnd.spring-boot.actuator.v2')) {
188+
this.availableMetrics = res.data.names;
189+
this.availableMetrics.sort();
190+
this.selectedMetric = this.availableMetrics[0];
191+
} else {
192+
this.isOldMetrics = true;
193+
}
185194
} catch (error) {
186195
console.warn('Fetching metric index failed:', error);
187196
this.hasLoaded = true;

0 commit comments

Comments
 (0)