Add mapping metadata of service (registered in Eureka) to ServiceMeta… #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 usedeach metadata of service (registered in Eureka) appears as ServiceMeta, NodeMeta map is empty
2
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 empty
3
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