【发布时间】:2015-12-28 09:58:31
【问题描述】:
我打算使用提供的@Timed 注释,而不是通过将代码插入每个感兴趣的方法来进行测量。但指标没有显示任何对应的值:
这是我的代码,想法是将包含的 SQL 的执行时间放入指标中。
@Component
public class Foo {
private JdbcTemplate jdbcTemplate;
@Autowired
public Metadata(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Timed(name = "myapp.get.foo")
public boolean getFoo(final String foo ) {
String foo = jdbcTemplate.query( ...
}
}
@Timed没有出现的问题可能是因为Spring Boot only supports Counter and Gauge。
但是@Gauge、@Metered 和@Counted 也不起作用。
为了至少使 Spring Boot 支持的那些指标注释工作,我缺少什么? (在我的测试中是 1.3.1)
【问题讨论】:
标签: java spring-boot metrics codahale-metrics spring-boot-actuator