I have a microservice which is automatically registered with Consul using Spring Cloud however when the service shuts down it's de-registered which means alerting we have configured using Prometheus fires once and then auto-resolves. How can I disable this functionality so the service remains registered unless manually removed.
Asked
Active
Viewed 870 times
4
-
Looks like this is not currently possible. `AbstractAutoServiceRegistration#stop` calls `ConsulAutoServiceRegistration#deregister` - I will open an enhancement request on github – Jon Freedman Jun 21 '17 at 10:00
-
https://github.com/spring-cloud/spring-cloud-consul/issues/321 – Jon Freedman Jun 21 '17 at 10:22
-
It seems to me that you are doing something wrong (or you have a very unique case). One of the main ideas of the Discovery Services like Consul or Eureka is to make sure that they have information about all the live services in the system, so whenever service A wants to call an instance of the service B Discovery Service guarantees that service A gets locations of alive instances of service B. Why would service A need a dead service location? – Danylo Zatorsky Jun 22 '17 at 20:02
-
Consul knows about service health, if you query it properly it won't give you details of a service which is down. Without this feature we would need to disable auto-registration and do it all manually – Jon Freedman Jun 23 '17 at 05:54
-
It's not supported by the current framework version, and to me this seems illogical. We've also had to deal with this case and ended up having a custom checker that queries the discovery server, searching for a set of required services to be present and in 'UP' state. I guess, in Promerheus terms that would mean writing a collector of your own. – jihor Jun 29 '17 at 17:59
-
It's certainly possible to hard-code what Prometheus should monitor, but that somewhat misses the point. Feel free to vote/comment on my [PR](https://github.com/spring-cloud/spring-cloud-consul/pull/322) – Jon Freedman Jun 30 '17 at 07:14