我使用dropwizard 0.6.2作为我的服务。来自dropwizard的运行状况检查响应返回纯文本。我在stackoverflow中找到了一个question,它的答案是我们可以将ObjectMapper传递给健康检查。但我无法找到将ObjectMapper传递给HealthCheck的方法。
有没有办法在JSON中返回健康检查响应?
发布于 2014-08-15 00:19:13
从Dropwizard JSON 0.7开始,/healthcheck路径返回响应:
HTTP/1.1 200 OK
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 299
Content-Type: application/json
Date: Thu, 14 Aug 2014 07:55:29 GMT
{
"My custom HealthCheck":
{
"healthy": true,
"message": "your message here"
},
"deadlocks":
{
"healthy": true
},
"storage":
{
"healthy": true
}
}发布于 2014-04-06 01:17:30
下拉向导使用codehale HealthCheck类。您可以调用Result.healthy()并将参数传递给您的JSON字符串。在调用healthcheck的方法中,您可以使用:
Result.healthy("your json");https://stackoverflow.com/questions/22858880
复制相似问题