我想将 Micrometer 的 @Timed 注释中的数据捕获到 Prometheus 指标存储/注册表中。我在网上找不到任何关于如何做到这一点的解释。
这些是我正在使用的版本:
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'
我正在尝试计时存储库调用:
interface HouseRepository {
@Timed
@Query(some long complicated query)
House deleteByAddressAndLastModifiedBefore(
Address address,
Instant instant
)
}
我该怎么做呢?我尝试在 @Timer 注释中添加一些不同的配置,例如:
@Timed(description = 'this.is.my.metric', value = 'my.metric', extraTags = ['my.metric.name', 'test'])
但我在 Prometheus (/prometheus) 中看不到我的输出。
当然,这可能吗?