Recently I update spring-boot-starter-actuator to 2.2.2 and when I consume the /health endpoint i got:
{
"groups": [],
"status": {
"code": "UP",
"description": ""
}
}
instead of:
{
"status": "UP"
}
And i don't have any clue the reason of this. Any idea? Or how I can refomat the output json to the original format? Not overwrite the HealthIndicator, only reformat.
Thanks in advance.
Spring Actuator 2.2 Health Endpoint JSON documentation says:
The /actuator/health endpoint has changed the resulting JSON format by
renaming details to components for the first-level elements. This
helps to differentiate the actual details returned by a
HealthIndicator from the component indicators that make up composite
health.
As a result of the change, the actuator media type has been bumped
from application/vnd.spring-boot.actuator.v2+json to
application/vnd.spring-boot.actuator.v3+json. If you have tools that
need to consume the older format, you can use an HTTP Accept: header
with the V2 media type, application/vnd.spring-boot.actuator.v2+json.
In addition if you want to see all documentation related to health and what is groups ? how to custom the health indicator take a look the
Current Health Information
Related
I am currently using spring boot 2.1.4 and jackson 2.9.8
When hitting the health endpoint the details are not displayed.
{
status: "UP"
}
I have added the following property to my configuration.
management.endpoint.health.show-details=always
When I look at the environment management.endpoint.health.show-details it is set.
When I monitor org.springframework.boot.actuate.health.HealthWebEndpointResponseMapper.HealthWebEndpointResponseMapper(HealthStatusHttpMapper, ShowDetails, Set<String>) it is showing that ALWAYS is in fact being used, and details is not being stripped out.
However, when it gets to com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector it doesn't add details, because the method getDetails has not been annotated in org.springframework.boot.actuate.health.Health like it has with getStatus (being #JsonWrapped)
How do I get details to be serialized by Jackson, so they can be returned via the health endpoint?
EDIT: This appears to be getting caused by a custom ObjectMapper that is being injected into the spring environment at startup which sets both AUTO_DETECT_GETTERS and AUTO_DETECT_IS_GETTERS to disabled. While this may of worked in spring 4, it no longer appears to work in spring 5.
I have an AWS lambda that acts on an events of the form:
{"id": "some-id", "stuff": "bla-bla-stuff-here" }
Now I want to attach an API Gateway endpoint with POSTs to an url of the form /stuff/{id} where the actual stuff would go in the body. So, on the integration request of the method there is a mapping template section which seems to allow for something like:
{
"id": $input.params('id'),
"stuff": $input.body
}
Now, how do I specify this template in the SAM file?
SAM uses the Proxy integration to Lambda which I don't think works with request/response mapping. If it does, you would need to specify this in Swagger as the DefinitionBody property of the Serverless::Api as SAM doesn't currently have a property for adding Request/Response mapping and generating the Swagger for you. The easiest way to use Swagger is to inspect the generated CloudFormation template of your stack; copy-paste it into your SAM template under DefinitionBody; and then apply the necessary Swagger additions.
I'm documenting my API with Swagger and I'm applying the following annotation to all of my REST Controllers:
#Api(value = "Some value", description = "Some Description", tags = {"Tag Tag Tag"})
However, I also want to include the endpoints provided by Spring Boot Actuator (/health, /info) on Swagger (and they are being included), however I can't seem to find a way to change their default description, tags, and title, among other swagger properties.
Is there a way to do this? Thanks in advance.
I have a RESTful web service that uses a custom Accept header to do versioning.
Adding the custom header value to the produces attribute in the #RequestMapping annotation as described on Baeldung doesn't seem work in a webflux enabled project.
Doing the same thing in a different non-webflux Springboot webservice works as expected.
When sending the custom header from a REST client, to the webflux enabled project I get an error that looks like:
{
"timestamp": "2019-01-03T21:25:34.885+0000",
"path": "/some/resource/ID",
"status": 406,
"error": "Not Acceptable",
"message": "Could not find acceptable representation"
}
I have two Spring Boot application. I've added Spring Boot Actuator both of them. When I run one of them I can see diskSpace:
{
"status": "UP",
"diskSpace": {
"status": "UP",
"total": 399055067136,
"free": 346446485504,
"threshold": 10485760
}
}
However at other service I can only see:
{
"status": "UP"
}
Even I add that property to second service:
management:
health:
diskspace:
enabled: true
I still cannot see diskSpace information. When I debug the system I see that such properties are collected but not returned to UI. What can be the problem?
Because only ADMINs are authorized to see any more info than this
{
"status": "UP"
}
To see all the metrics, authenticate with any user who has a spring security role ADMIN.
Or
(less preferable option)
Disable security for actuator endpoint like this
in application properties yaml file
management:
security:
enabled: false
In case if you are using spring security which is by default ON for actuator endpoints, you can disable it in your yml file -
management:
security:
enabled: false
management.security.enabled is deprecated now.
You can get full health details by adding a line in application.properties:
management.endpoint.health.show-details=always
Just add a line in application.properties:
management.endpoint.health.show-details = always
this made health show details to all users other than authorized people.
Spring boot actuator's HealthIndicator checks available disk space and reports a status of Status#DOWN when it drops below a configurable threshold.
so in your case for the second application the free space available is more than the threshold hence hou don't see any thing being reported.
you probably can debug and see in your code the values free disk space and the threshold.
let me know if this make sense...