如何从Spring-Boot Api获取http_指标

时间:2017-12-18 09:49:35

标签: spring-boot prometheus

我有来自Spring Boot Api的指标列表,但它不包含http_ *指标

我的pom.xml包含

<prometheus.version>0.1.0</prometheus.version>
      ....

<dependency>
  <groupId>io.prometheus</groupId>
  <artifactId>simpleclient_hotspot</artifactId>
  <version>${prometheus.version}</version>
</dependency>

<dependency>
  <groupId>io.prometheus</groupId>
  <artifactId>simpleclient_servlet</artifactId>
  <version>${prometheus.version}</version>
</dependency>

<dependency>
  <groupId>io.prometheus</groupId>
  <artifactId>simpleclient</artifactId>
  <version>${prometheus.version}</version>
</dependency>

我创建了DefaultExports.initialize()并设置了bean

@Bean
  SpringBootMetricsCollector springBootMetricsCollector(Collection<PublicMetrics> publicMetrics) {


    SpringBootMetricsCollector springBootMetricsCollector = new SpringBootMetricsCollector(publicMetrics);
    springBootMetricsCollector.register();

    return springBootMetricsCollector;
  }

然后我从spring boot api获得指标列表,但它不包含htpp_ *指标 像http_request_duration_microseconds 我怎么能得到它?

0 个答案:

没有答案