我遵循指示,将 coda hale 指标库添加到类路径中会自动自动配置指标。
这有效,我得到了注入的 metricRegistry bean。
但是,如何在 /metrics 端点中公开这些新指标?
Thanks!
有一些集成魔法通过http://www.ryantenney.com/metrics-spring/ http://www.ryantenney.com/metrics-spring/将 codahale 指标连接到执行器中/health
端点。
包含这种依赖关系后,
compile 'com.ryantenney.metrics:metrics-spring:3.0.0-RC2'
您可以在应用程序配置中“enableMetrics”
@EnableMetrics
public class ApplicationConfiguration {
...
这允许您为每个请求计时@timed
注解:
@Timed
@RequestMapping(method=RequestMethod.GET)
public @ResponseBody
Foo foo() {
...
并与您进行其他互动MetricRegistry
聚合到执行器中/health
端点。
我整理了一个实现此集成的示例应用程序:
https://github.com/benschw/consul-cluster-puppet/tree/master/demo https://github.com/benschw/consul-cluster-puppet/tree/master/demo
并在这里编写了更深入的教程:http://txt.fliglio.com/2014/10/spring-boot-actuator/ http://txt.fliglio.com/2014/10/spring-boot-actuator/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)