codecentric / spring-boot-admin

Admin UI for administration of spring boot applications
Apache License 2.0
12.39k stars 3.08k forks source link

Spring Admin UI is flooded with "Request failed" error toasts when EVCache size is null #2178

Closed iuliiasobolevska closed 1 year ago

iuliiasobolevska commented 1 year ago

Spring Boot Admin Server information

Description

Spring Boot Admin shows an increased number of error toasts when cache.size metric is absent after updating to version 2.7.7. This is a result of the change made in https://github.com/codecentric/spring-boot-admin/commit/330252c385d93a1902dbcb131b848b81623086a5 that surfaces errors that were previously swallowed.

Root cause

Micrometer doesn't emit cache.size metric when EVCache size() method returns null:

but Spring Admin expects metric to be present:

showing a "Request failed" toast with the following error in the console when response is undefined:

Fetching cache EVCACHE_TEST size failed - error is ignored TypeError: Cannot read properties of undefined (reading 'data')
    at details-cache.vue:131:1
    at l (runtime.js:63:40)
    at Generator._invoke (runtime.js:294:22)
    at Generator.next (runtime.js:119:21)
    at r (asyncToGenerator.js:3:20)
    at s (asyncToGenerator.js:25:9)

Unfortunately, I don't have a screenshot right now but the first time the issue was observed the whole screen was flooded with error toasts which is surprising given that shouldFetchCacheSize should get set to false when the 1st issue is observed:

Potential solutions

I'm happy to submit a PR if you support the suggestion to handle response being undefined in a way that would disable further cache.size retrieval and do not show error toast at all (even for the 1st error) to not confuse customers.

SteKoe commented 1 year ago

Hi,

we have just released version 2.7.9 of SBA that includes a property to enable toasts spring.boot.admin.ui.enable-toasts. They are disabled by default, now. We hope that this reduces the confusion.

iuliiasobolevska commented 1 year ago

Appreciate the prompt response. What I was trying to point out is that it's totally valid for cache.size metric to not be emitted and Spring Admin doesn't respect that and as a result breaks contract. Disabling error toasts would hide the issue and as you pointed out would confuse customers less but it doesn't feel like the right fix. Apologies for not clearly explaining what I think the issue is about.

iuliiasobolevska commented 1 year ago

@SteKoe, I would appreciate your thoughts on my last comment and wondering this issue should be reopened.

SteKoe commented 1 year ago

Hi @iuliiasobolevska,

sorry for closing the issue, we would love to see a PR fixing the issue in the frontend! :)

Kind regards SteKoe