I upgraded my apps from SpringBoot 2.1.18 to SpringBoot 2.5.7 and I see that health details such as diskSpace no longer show up in SpringBootAdmin UI after the upgrade. I am using SBA 2.0.0 and have not changed that.
The health endpoint still includes them, but the top level key has been renamed from details to components. I assumed that was what was confusing SBA, but even stranger my custom health indicator still displays in SBA despite this.
Any idea how I can solve this?
old
{
"status": "OUT_OF_SERVICE",
"details": {
"myCustomHealthIndicator": {
"status": "OUT_OF_SERVICE",
"details": {
"Reason": "Suspect State message received",
"StateText": "Connection failed; Channel disconnected"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 107361579008,
"free": 94436716544,
"threshold": 10485760
}
},
"refreshScope": {
"status": "UP"
}
}
}
new
{
"status": "OUT_OF_SERVICE",
"components": {
"diskSpace": {
"status": "UP",
"details": {
"total": 107361579008,
"free": 100102447104,
"threshold": 10485760,
"exists": true
}
},
"livenessState": {
"status": "UP"
},
"ping": {
"status": "UP"
},
"readinessState": {
"status": "UP"
},
"myCustomHealthIndicator": {
"status": "OUT_OF_SERVICE",
"details": {
"Reason": "Suspect State message received",
"StateText": "Connection failed; Channel disconnected"
}
}
},
"groups": [
"liveness",
"readiness"
]
}
Solved by upgrading to Spring Boot Admin Server 2.5.4 ( de.codecentric:spring-boot-admin-starter-server:jar:2.5.4 )
Related
I have a Spring boot application with actuator enabled so that I can use the /actuator/health URIs as probes. My application talks to redis, JMS and cosmos so those are checked as part of the health response.
When I run the application at my command prompt I get the following JSON response, with a HTTP 200 code indicating all is well.
{
"status": "UP",
"components": {
"cosmos": {
"status": "UP",...
},
"diskSpace": {
"status": "UP",...
},
"grpcChannel": {
"status": "UP",...
},
"jms": {
"status": "UP",...
}
},
"ping": {
"status": "UP"
},
"redis": {
"status": "UP",...
}
}
}
When I deploy the application to a K8S environment (Rancher locally or Azure in the cloud) the application knows it is now in a K8S environment and so adds some additional stuff to the health check. However while the main components are all UP - as for the local run - I now get a 503 Service Unavailable response code and the livenessState is DOWN and the readinessState is OUT_OF_SERVICE.
{
"status": "DOWN",
"components": {
"cosmos": {
"status": "UP",...
},
"diskSpace": {
"status": "UP",...
},
"grpcChannel": {
"status": "UP",...
},
"jms": {
"status": "UP",...
}
},
"livenessState": {
"status": "DOWN"
},
"ping": {
"status": "UP"
},
"readinessState": {
"status": "OUT_OF_SERVICE"
},
"redis": {
"status": "UP",
"details": {
"cluster_size": 3,
"slots_up": 16384,
"slots_fail": 0
}
}
},
"groups": [
"liveness",
"readiness"
]
}
What additional checks is the actuator doing when in K8S and what do I need to do for actuator to report it is all OK? Any suggestions as to how to troubleshoot the problem?
I have searched for more information on SO and the wider web, but cannot find anything that helps find out what the K8S checks are specifically looking for.
Thank you.
My application enables health check with application properties like below.
# health check config
management.endpoint.health.show-details=always
management.endpoints.web.base-path=/
management.endpoints.web.path-mapping.health=health
So if i request GET /health to application.
i get this reponse.
{
"status": "UP",
"components": {
"db": {
"status": "UP",
"details": {
"database": "H2",
"validationQuery": "isValid()"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 247862915072,
"free": 139563880448,
"threshold": 10485760,
"path": "C:\\Users\\~~",
"exists": true
}
},
"ping": {
"status": "UP"
}
}
}
When i saw this response. i dont wanna response some data like database type (H2).
I know that i can't change response data from actutator.
But is there way to modify data like below code in spring boot?
#RestController
#RequestMapping("/health")
public class HealthController {
#GetMapping()
public HealthResponse get() {
// Below code is just example. i wonder that i can get origin /health api data.
HealthOriginResponse origin = HealthModule.getData()
return new HealthResponse(origin.status, origin.db.status, origin.diskSpace.status);
}
}
If there is no way. i consider to use interceptor for modifying.
we have multiple health checks for our application, but if one of the components health check fails - then the status of the whole application changes to "DOWN".
What we want is the application status to still be "UP", even if a single component fails.
How to prevent a single failing component check to change the application status?
Here is an example of our health checks:
{
"status": "UP",
"components": {
"db": {
"status": "UP",
"details": { "database": "MariaDB", "validationQuery": "isValid()" }
},
"discoveryComposite": {
"description": "Discovery Client not initialized",
"status": "UNKNOWN",
"components": {
"discoveryClient": {
"description": "Discovery Client not initialized",
"status": "UNKNOWN"
}
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 117404147712,
"free": 102471593984,
"threshold": 10485760,
"exists": true
}
},
"linkFlow": {
"status": "UP",
"details": { "message": "LinkFLow er tilgjengelig" }
},
"nissy": {
"status": "UP",
"details": { "message": "Nissy er tilgjengelig" }
},
"ping": { "status": "UP" },
"reactiveDiscoveryClients": {
"description": "Discovery Client not initialized",
"status": "UNKNOWN",
"components": {
"Simple Reactive Discovery Client": {
"description": "Discovery Client not initialized",
"status": "UNKNOWN"
}
}
},
"refreshScope": { "status": "UP" },
"zisson": {
"status": "UP",
"details": { "message": "Zisson API er tilgjengelig" }
}
}
}
Implementation of healthcheck:
#Component
#Slf4j
public class ZissonHealthIndicator implements HealthIndicator {
private final ZissonAPIGateway zissonAPIGateway;
public ZissonHealthIndicator(ZissonAPIGateway zissonAPIGateway) {
this.zissonAPIGateway = zissonAPIGateway;
}
#Override
public Health health() {
if (zissonAPIGateway.isAvailable()) {
return Health.up().withDetail("message", "Zisson API er tilgjengelig").build();
}
log.warn("Helsesjekk: Zisson er utilgjengelig");
return Health.down().withDetail("message", "Zisson er ikke tilgjengelig").build();
}
}
Yes you can. Just create your own StatusAggregator:
#Component
public class CustomHealthAggregator extends SimpleStatusAggregator {
#Override
public Status getAggregateStatus(Set<Status> statuses) {
// or some othe logic here
if (statuses.contains(Status.UP)) {
return Status.UP;
}
return super.getAggregateStatus(statuses);
}
}
I am currently building an application for which it is important to check the existence of resources with a certain profile.
As we need to check this for 40+ profiles I'd like to put this all in 1 batch request and let our HAPI-FHIR server implementation handle this, as opposed to querying them one by one. This would get too chatty otherwise.
Because I only need to know about whether the resource exists I'd like to use _summary=count. I am assuming this increases the performance of the request.
Example request
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"request": {
"method": "GET",
"url": "/Observation?_profile=http://nictiz.nl/fhir/StructureDefinition/zib-DrugUse&_summary=true"
}
},
{
"request": {
"method": "GET",
"url": "/RelatedPerson?_profile=http://fhir.nl/fhir/StructureDefinition/nl-core-relatedperson&_summary=count"
}
}
]
}
Response
{
"resourceType": "Bundle",
"id": "fd66cfd9-4693-496d-86fc-98289067480b",
"type": "batch-response",
"link": [
{
"relation": "self",
"url": "<redacted>"
}
],
"entry": [
{
"resource": {
"resourceType": "Bundle",
"id": "2647a49f-0503-496b-b274-07d4e9163f1b",
"meta": {
"lastUpdated": "2021-02-15T11:44:18.035+00:00",
"tag": [
{
"system": "http://hl7.org/fhir/v3/ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
}
]
},
"type": "searchset",
"total": 48
},
"response": {
"status": "200 OK"
}
},
{
"resource": {
"resourceType": "Bundle",
"id": "2f9cc861-5d20-4da1-aa9f-12153b75539d",
"meta": {
"lastUpdated": "2021-02-15T11:44:18.151+00:00",
"tag": [
{
"system": "http://hl7.org/fhir/v3/ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
}
]
},
"type": "searchset",
"total": 10
},
"response": {
"status": "200 OK"
}
}
]
}
Can I assume that the ordering of the batch-response is the same as that of the batch-request?
Or is there a method to annotate the batch entries which are persisted onto the batch-response?
Or finally, is there a flag I can turn on to make the response include the request.url part?
I'm using HAPI-FHIR 5.1.0 both for client and server.
Apparently I didn't look well enough in the specs, as I just found the following:
From the FHIR spec
For a batch, or a successful transaction, the response the server SHALL return a Bundle with type set to batch-response or transaction-response that contains one entry for each entry in the request, in the same order, with the outcome of processing the entry.
We are using 2.1.3 version for spring cloud stream kafka streams -
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka-core</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
application.yml has property set -
management.health.binders.enabled = true
management.health.kafka.enabled = true
But we are still get the status as UNKNOWN for kafka binders -
"binders": {
"status": "UNKNOWN",
"details": {
"ktable": {
"status": "UNKNOWN"
},
"kstream": {
"status": "UNKNOWN"
},
"globalktable": {
"status": "UNKNOWN"
}
}
}
Appreciate any help on this.
The health indicators for Kafka Streams family of binders only went into the 2.2 line. Any chance you can upgrade to 2.2 from 2.1.3? Here is an application where the health indicators are working. This is using the 3.0 snapshots, but 2.2 also should work. When running this app, I am getting the output as below.
curl --silent http://localhost:8080/actuator/health/ | jq .
{
"status": "UP",
"components": {
"binders": {
"status": "UP",
"components": {
"globalktable": {
"status": "UP",
"details": {
"threadState": "RUNNING",
"standbyTasks": {},
"activeTasks": {
"partitions": [
"partition=0, topic=process-applicationId-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition"
],
"taskId": "1_0"
},
"threadName": "process-applicationId-fa4e65eb-6060-43f0-94eb-4c4bf1497613-StreamThread-1"
}
},
"kstream": {
"status": "UP",
"details": {
"threadState": "RUNNING",
"standbyTasks": {},
"activeTasks": {
"partitions": [
"partition=0, topic=process-applicationId-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition"
],
"taskId": "1_0"
},
"threadName": "process-applicationId-fa4e65eb-6060-43f0-94eb-4c4bf1497613-StreamThread-1"
}
},
"ktable": {
"status": "UP",
"details": {
"threadState": "RUNNING",
"standbyTasks": {},
"activeTasks": {
"partitions": [
"partition=0, topic=process-applicationId-KSTREAM-AGGREGATE-STATE-STORE-0000000003-repartition"
],
"taskId": "1_0"
},
"threadName": "process-applicationId-fa4e65eb-6060-43f0-94eb-4c4bf1497613-StreamThread-1"
}
}
}
},
"diskSpace": {
"status": "UP",
"details": {
...
}
},
"ping": {
"status": "UP"
}
}
}
Note - The issue mentioned in the comments below where multiple processor's health information is not shown is addressed in the latest snapshots of the binder (3.0.0) and will be available as part of RC1.