简体   繁体   中英

How to enable spring-actuator to collect metrics from multiple applications

I have a pod which consists of multiple containers each have an application running. How do I enable actuator to fetch metrics from these applications. I couldn't find a way to do this.

There are four micro services running in the pod on different ports say 8082, 8080, 8081, 8083. But the actuator is scraping the metrics only from the micro service running on 8080(default port).

I tried adding application properties indicated in code section to all properties. but it didn't work. Here is the application.property content:

management.endpoint.metrics.enabled=true  
management.endpoints.web.exposure.include=*  
management.endpoint.prometheus.enabled=true  
management.metrics.export.prometheus.enabled=true  
management.metrics.use-global-registry=true  
management.server.port=8888  

Expected output: I should be able to see the metrics from each applications using /metrics endpoint.

I was able to solve this problem. Here are the steps:

  1. Configure separate acutator ports for each service in application.properties.
  2. Expose the configure ports in deployment yaml(in case of kubernetes).

That's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM