Commit ae8596cd by Johannes Edmeier

Using ehcache the cache statistics are not showing up

The caches.size metric is not available for every cache implementation. If the metric is not available the ui should still show hits and misses. This commit ignores errors for the cache size and will do no further requests for this metric after an error occurred. fixes #756
parent 2588b11d
......@@ -45,7 +45,7 @@
<p v-text="ratio"/>
</div>
</div>
<div class="level-item has-text-centered">
<div v-if="current.size" class="level-item has-text-centered">
<div>
<p class="heading">Size</p>
<p v-text="current.size"/>
......@@ -81,6 +81,7 @@
hasLoaded: false,
error: null,
current: null,
disableSize: false,
chartData: [],
}),
computed: {
......@@ -95,10 +96,18 @@
async fetchMetrics() {
const responseHit = this.instance.fetchMetric('cache.gets', {name: this.cacheName, result: 'hit'});
const responseMiss = this.instance.fetchMetric('cache.gets', {name: this.cacheName, result: 'miss'});
const responsSize = this.instance.fetchMetric('cache.size', {name: this.cacheName});
let size = undefined;
if (!this.disableSize) {
const responsSize = this.instance.fetchMetric('cache.size', {name: this.cacheName});
try {
size = (await responsSize).data.measurements[0].value;
} catch (error) {
this.disableSize = true;
console.warn('Fetching cache size failed - error is ignored', error)
}
}
const hit = (await responseHit).data.measurements[0].value;
const miss = (await responseMiss).data.measurements[0].value;
const size = (await responsSize).data.measurements[0].value;
return {
hit,
miss,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment