【问题标题】:Configure Prometheus for monitoring multiple microservices配置 Prometheus 监控多个微服务
【发布时间】:2021-09-12 11:09:30
【问题描述】:

我想监控在Docker-Compose 上运行的Spring Boot 微服务应用程序,其中包含大约20 个微服务,PrometheusGrafana

什么是最好的方法:
1- 每个微服务都有一个具有多个目标的工作?

scrape_configs:
  - job_name: 'services-job'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['service-one:8080']
        labels:
          group: 'service-one' 
      - targets: ['service-two:8081']
        labels:
          group: 'service-two' 

2- 每个服务都有多个作业,每个服务都有一个目标?

scrape_configs:
  - job_name: 'service-one-job'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['service-one:8080']
        labels:
          group: 'service-one'
  - job_name: 'service-two-job'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['service-two:8081']
        labels:
          group: 'service-two'  
 

【问题讨论】:

    标签: docker-compose microservices prometheus monitoring


    【解决方案1】:

    按作业对目标进行分组的方式与要抓取的端点数量无关。

    您需要将具有相同目的的所有目标分组到同一个作业中。这正是documentation 所说的:

    具有相同目的的实例集合,例如为了可扩展性或可靠性而复制的流程,称为作业。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-16
      • 2019-03-25
      • 1970-01-01
      相关资源
      最近更新 更多