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
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:
eurekaConsulAdapter.useNodeMeta is not set or is set to false
eurekaConsulAdapter.nodeMetaPrefix in this case is not used
each metadata of service (registered in Eureka) appears as ServiceMeta, NodeMeta map is empty
2
eurekaConsulAdapter.useNodeMeta is set to true
eurekaConsulAdapter.nodeMetaPrefix is not set (default value) or is set to "" (empty string)
each metadata of service (registered in Eureka) appears as NodeMeta, ServiceMeta map is empty
3
eurekaConsulAdapter.useNodeMeta is set to true
eurekaConsulAdapter.nodeMetaPrefix is set to e.g. nodeMeta_
each metadata of service (registered in Eureka) is filtered according to the following rules:
metadata which key begins with nodeMeta_ is moved to NodeMeta map (during moving prefix is removed nodeMeta_k1 -> k1)
metadata which key not begins with nodeMeta_ is moved to ServiceMeta map
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:
eurekaConsulAdapter.useNodeMeta
: boolean (default: false)eurekaConsulAdapter.nodeMetaPrefix
: String (default: "")Possible scenarios of usage:
1
eurekaConsulAdapter.useNodeMeta
is not set or is set tofalse
eurekaConsulAdapter.nodeMetaPrefix
in this case is not used each metadata of service (registered in Eureka) appears as ServiceMeta, NodeMeta map is empty2
eurekaConsulAdapter.useNodeMeta
is set totrue
eurekaConsulAdapter.nodeMetaPrefix
is not set (default value) or is set to""
(empty string) each metadata of service (registered in Eureka) appears as NodeMeta, ServiceMeta map is empty3
eurekaConsulAdapter.useNodeMeta
is set totrue
eurekaConsulAdapter.nodeMetaPrefix
is set to e.g.nodeMeta_
each metadata of service (registered in Eureka) is filtered according to the following rules:nodeMeta_
is moved to NodeMeta map (during moving prefix is removed nodeMeta_k1 -> k1)nodeMeta_
is moved to ServiceMeta map