2

I am newbie to micrometer. could anyone let me know how to manage microservice metrics centrally in spring boot ?

Where i can get all registered service information and matrices and stored metrics in influxdb ?

Bhargav Patel
  • 1,098
  • 10
  • 23

1 Answers1

2

Assuming that you're asking "How to use Micrometer with Spring Boot for collecting metrics from heterogeneous services which have multiple instances on multiple hosts" as there is nothing special with the microservice architecture compared to the assumed environment, you need to add dimensions to metrics for hosts, application instances, and so on. You can achieve it with the common tags support. See the section for it in the Spring Boot reference guide.


UPDATED:

To answer the additional question on the below comment, I created a sample showing how to use common tags with environment variables. Note that it's on the branch common-tags-2.1.x-with-env, not the master.

Johnny Lim
  • 5,623
  • 8
  • 38
  • 53
  • Thanks for quick reply. Sound good but where i can keep common tag ? lets say i have docker image for microservice-1 and i have coded for "region-1". This region name added to my yml file. now i have hosted microservice-1 in region-2 in this case ii has sill same yml file so it tagged again region -1.. much confusion for me. – Bhargav Patel Aug 22 '18 at 15:04
  • @BhargavPatel You can use environment variables like other properties in Spring Boot. I updated the answer to have a link to a sample demonstrating it. – Johnny Lim Aug 22 '18 at 16:32
  • @BhargavPatel, all your instances for the same service has the same environment. How can you have a unique tag per instance? Also how would you aggregate the data across instances? – Alwyn Schoeman Jun 07 '19 at 13:40
  • @AlwynSchoeman You can pass ENV variable which can by-forget unique instance on start up of your service – Bhargav Patel Jun 07 '19 at 14:43