4、集成 Prometheus 监控

项目中引入 micrometer-prometheus 依赖,可实现 rabbitmq 组件的指标采集

<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

可采集到如下指标:

# HELP rabbitmq_channels  
# TYPE rabbitmq_channels gauge
rabbitmq_channels{application="app-test",name="rabbit",} 3.0
# HELP rabbitmq_connections  
# TYPE rabbitmq_connections gauge
rabbitmq_connections{application="app-test",name="rabbit",} 2.0
# HELP rabbitmq_acknowledged_total  
# TYPE rabbitmq_acknowledged_total counter
rabbitmq_acknowledged_total{application="app-test",name="rabbit",} 0.0
# HELP rabbitmq_rejected_total  
# TYPE rabbitmq_rejected_total counter
rabbitmq_rejected_total{application="app-test",name="rabbit",} 0.0
# HELP rabbitmq_acknowledged_published_total  
# TYPE rabbitmq_acknowledged_published_total counter
rabbitmq_acknowledged_published_total{application="app-test",name="rabbit",} 0.0
 # HELP rabbitmq_published_total  
# TYPE rabbitmq_published_total counter
rabbitmq_published_total{application="app-test",name="rabbit",} 1.0
# HELP rabbitmq_unrouted_published_total  
# TYPE rabbitmq_unrouted_published_total counter
rabbitmq_unrouted_published_total{application="app-test",name="rabbit",} 0.0
# HELP rabbitmq_consumed_total  
# TYPE rabbitmq_consumed_total counter
rabbitmq_consumed_total{application="app-test",name="rabbit",} 0.0
# HELP rabbitmq_failed_to_publish_total  
# TYPE rabbitmq_failed_to_publish_total counter
rabbitmq_failed_to_publish_total{application="app-test",name="rabbit",} 0.0
作者:Jeebiz  创建时间:2023-05-05 14:26
最后编辑:Jeebiz  更新时间:2024-11-01 10:06