Instead of measuring by inserting code into each method of interest I intended to use the provided @Timed
annotation. But the metrics do not show any corresponding values:
This is my code, the idea is having the execution times of the contained SQL being put into the metrics.
@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( ...
}
}
The problem with @Timed
not showing up is probably because Spring Boot only supports Counter and Gauge.
But @Gauge
, @Metered
and @Counted
don't work either.
What am I missing in order to make at least those metrics annotation work that are supported by Spring Boot ? (1.3.1 in my tests)