twinformatics / eureka-consul-adapter

This project contains a Spring Boot Starter that registers HTTP endpoints on a Spring Cloud Eureka server to support Prometheus's service discovery mechanism for Consul (<consul_sd_config>)
MIT License
102 stars 35 forks source link

Add mapping metadata of service (registered in Eureka) to ServiceMeta… #16

Closed ziebapawel closed 5 years ago

ziebapawel commented 5 years ago

Firstly I would like to thank you for creating this library. It's very helpful. Several months ago we've started to monitoring our applications by Prometheus. Most of the time Consul has been used as Discover Service but two weeks ago we've decided to use Eureka with Eureka Consul Adapter as Discovery Service. Our services are registered with additional metadata and we use them in relabeling phase of Prometheus. During relabeling phase we use following meta label __meta_consul_service_metadata_<key>. With Consul it works correctly but with Eureka with Eureka Consul Adapter it doesn't work as we expected. We noticed that metadata associated with service (registered in Eureka) appears as NodeMeta instead of ServiceMeta. In our opinion metadata of service registered in Eureka should appear as ServiceMeta because these metadata are associated with service, not with node of Consul.

We've made changes that make metadata of service (registered in Eureka) appears as ServiceMeta.

For backward compatibility we introduce following properties:

Possible scenarios of usage:

1

2

3

tine2k commented 5 years ago

Thanks for your PR @ziebapawel. Please give me a couple a days for the review. Work is very busy atm :(

tine2k commented 5 years ago

@ziebapawel I merged your PR and released your changes as version 1.3.0. Thanks for your contribution.