spring接入prometheus

2021-11-05  本文已影响0人  翘少楚

prometheus.yml/yaml 新增job

- job_name: 'springboot'
  metrics_path: '/actuator/prometheus'
  static_configs:
    - targets: 
        - 'ip:port'
      labels:
          instance: 'instanceName'

pom文件引包


        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
        <dependency>-->
            <groupId>org.springframework.boot</groupId>-->
            <artifactId>spring-boot-starter-actuator</artifactId>-->
        </dependency>-->

application.yaml 配置

#prometheus配置
management:
  endpoints:
    web:
      exposure:
        include: 'prometheus'
  metrics:
    tags:
      application: ${spring.application.name}


## 重启promethues
上一篇下一篇

猜你喜欢

热点阅读