本文介绍了如何使用Dropwizard healthcheck返回JSON响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力为我的dropwizard服务添加健康检查.问题是当我运行健康检查时,dropwizard返回纯文本响应.而且我只能在此输出中添加可选的字符串消息.

I've been working on adding healthchecks to my dropwizard service. The problem is dropwizard returns plain text responses when I run my healthchecks. And I can only add an optional string messages to this output.

例如:*可用磁盘空间:确定磁盘使用率不是很高(我的消息字符串)*可用内存:确定* CPU使用率:确定*死锁:确定

For example:* Available Disk Space: OKDisk usage is not critically high (my message string)* Available Memory: OK* CPU Usage: OK* deadlocks: OK

有没有办法以JSON格式返回这些消息,以便我可以轻松解析输出?

Is there a way to return these messages in JSON format so that I can parse the output easily?

感谢一百万!

推荐答案

如果可能,请升级到Dropwizard v0.7.1.默认的健康检查格式为JSON.

If possible, upgrade to Dropwizard v0.7.1. The default health check format will be JSON.

这篇关于如何使用Dropwizard healthcheck返回JSON响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 04:12