美文网首页
spring接入prometheus

spring接入prometheus

作者: 翘少楚 | 来源:发表于2021-11-05 13:55 被阅读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

    相关文章

      网友评论

          本文标题:spring接入prometheus

          本文链接:https://www.haomeiwen.com/subject/tylrzltx.html