-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(#5352): healthgroups endpoint #5416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
537eeee
c0c3dbf
58d8efd
e0a1510
95f761b
ffe3250
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,15 +175,9 @@ export default defineComponent({ | |
| this.healthGroupOpenStatus = {}; | ||
| this.healthGroupLoadingMap = {}; | ||
| this.healthGroupsError = null; | ||
| this.fetchHealthGroups(); | ||
| } else { | ||
| // Same instance, SSE update (e.g. status change) — collapse groups and clear stale data | ||
| for (const group of this.healthGroups) { | ||
| group.data = null; | ||
| } | ||
| this.healthGroupOpenStatus = {}; | ||
| this.healthGroupLoadingMap = {}; | ||
| } | ||
| // Re-fetch the (server-cached) group list on every instance change | ||
| this.fetchHealthGroups(); | ||
| }, | ||
| isHealthGroupOpen(groupName: string) { | ||
| return this.healthGroupOpenStatus[groupName]?.isOpen ?? false; | ||
|
|
@@ -214,10 +208,10 @@ export default defineComponent({ | |
| this.healthGroupsError = null; | ||
|
|
||
| try { | ||
| const res = await this.instance.fetchHealth(); | ||
| const res = await this.instance.fetchCachedHealthGroups(); | ||
|
|
||
| if (Array.isArray(res.data.groups)) { | ||
| this.healthGroups = res.data.groups.map((name: string) => ({ | ||
| if (Array.isArray(res.data)) { | ||
| this.healthGroups = res.data.map((name: string) => ({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @ulischulte. Will this assignment trigger a UI re-rendering?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it will trigger a re-rendering of UI. I will add a check to prevent this in terms of UX, as it will also reset the collapsed state. Changing groups in backend will not happen that often, though.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I was wondering exactly because their update will be very rare. |
||
| name, | ||
| data: null, | ||
| })); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Copyright 2014-2025 the original author or authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package de.codecentric.boot.admin.server.services; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import de.codecentric.boot.admin.server.domain.values.InstanceId; | ||
|
|
||
| /** | ||
| * Cache for health groups per instance. | ||
| */ | ||
| public interface HealthGroupsCache { | ||
|
|
||
| /** | ||
| * Update the health groups for an instance. If groups is null or empty, the entry is | ||
| * removed from the cache. | ||
| * @param instanceId the instance id | ||
| * @param groups the health groups list | ||
| */ | ||
| void updateGroups(InstanceId instanceId, List<String> groups); | ||
|
|
||
| /** | ||
| * Get the health groups for an instance. | ||
| * @param instanceId the instance id | ||
| * @return the list of health groups, or an empty list if none are cached | ||
| */ | ||
| List<String> getGroups(InstanceId instanceId); | ||
|
|
||
| /** | ||
| * Remove the health groups entry for an instance. | ||
| * @param instanceId the instance id | ||
| */ | ||
| void remove(InstanceId instanceId); | ||
|
|
||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this only if the instance has changed in some meaningful way regarding its status, which means to not do it if the event that gets sent is
INFO_UPDATED.If the
processInfoContributor is enabled, the data returned by https://docs.spring.io/spring-boot/api/rest/actuator/info.html changes on every poll, which would mean we're re-fetching the health groups over and over for no real reason.