I want to capture the data from Micrometer's @Timed annotation into the Prometheus metrics store/registry. I can't find any explanations on how to do this online.
These are the versions I am using:
compile 'org.springframework.boot:spring-boot-starter-web:2.1.4.RELEASE' // This already includes micrometer I believe
compile "io.micrometer:micrometer-registry-prometheus:1.1.4'
I'm trying to time a repository call:
interface HouseRepository {
@Timed
@Query(some long complicated query)
House deleteByAddressAndLastModifiedBefore(
Address address,
Instant instant
)
}
How do I do this? I tried adding some different configs to the @Timer annotation, such as:
@Timed(description = 'this.is.my.metric', value = 'my.metric', extraTags = ['my.metric.name', 'test'])
But I don't see my output in Prometheus (/prometheus).
Surely, this is possible to do?