简体   繁体   English

在 Java springboot 应用程序中使用千分尺收集 HikariCp 指标,方法是在

[英]HikariCp metrics collection using micrometer in Java springboot application by configuring it in

community, I have a requirement where I want to do HikariCp metrics collection using micrometre in Java spring boot application by configuring it.社区,我有一个要求,我想通过配置在 Java Spring Boot 应用程序中使用微米来进行 HikariCp 指标收集。 I was looking around but I could not find much help in the official documentation我环顾四周,但在官方文档中找不到太多帮助

https://github.com/brettwooldridge/HikariCP/tree/dev/src/main/java/com/zaxxer/hikari https://github.com/brettwooldridge/HikariCP/tree/dev/src/main/java/com/zaxxer/hikari

Can anyone please help me with how to do that?谁能帮助我如何做到这一点? Note: In the official documentation of Hikari they have provided a way to set metric registry for dropwizard but I wanted to do it with Micrometre.注意:在 Hikari 的官方文档中,他们提供了一种为 dropwizard 设置度量注册表的方法,但我想用 Micrometre 来做。

only data source autoconfigured is exposed for metrics in my case I have a custom Hikari data source configuration.在我的情况下,只有自动配置的数据源会暴露给指标我有一个自定义的 Hikari 数据源配置。

public myDataSource(){
   DataSource datasource = this.createDataSource();// you can write your own implementation to create datasource. you can pass URL, username etc to create it.
 this.setUpHikariWithMetrics();
}

public void setUpHikariWithMetrics() {
    if (dataSource instanceof HikariDataSource) {
        ((HikariDataSource) dataSource).setMetricRegistry(metricRegistry);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Micrometer指标运行SpringBoot 2应用程序时出错 - Error when running SpringBoot 2 application with Micrometer metrics Springboot:千分尺指标未显示 - Springboot: micrometer metrics not showing up 在 springboot /metrics 中暴露千分尺计时器的百分位值 - Exposing percentile values of micrometer timer in springboot /metrics 千分尺指标和 Application Insights java 代理 - 指标会累积,尽管它们不应该(或者我错过了什么) - Micrometer metrics & Application Insights java agent - Metrics accumulate although they shouldn't (or am I missing something) 如何在不使用 Spring 或 Spring Boot 的情况下使用 Micrometer 在 TICK 堆栈上收集指标? - How to use Micrometer for metrics collection on TICK stack without using Spring or Spring Boot? jersey 应用程序中的千分尺 Prometheus 指标(非弹簧) - Micrometer Prometheus metrics in jersey application (Non spring) 自 SpringBoot 2.3.x 以来,千分尺中缺少 kafka 指标 - kafka metrics missing in micrometer since SpringBoot 2.3.x 使用 spring java 的千分尺指标(没有 spring boot) - Micrometer metrics with spring java (NO spring boot) Java Micrometer - 如何处理 *_bucket 类型的指标 - Java Micrometer - What to do with metrics of type *_bucket Prometheus端点中不提供使用Micrometer的自定义指标 - Custom metrics using Micrometer is not available in Prometheus endpoint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM