Closed
Description
I used the following config to enable the TTL and DeregisterCriticalServiceAfter.
spring:
cloud:
consul:
host: localhost
port: 8500
discovery:
instance-id: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
health-check-critical-timeout: 3m
heartbeat:
enabled: true
ttl-value: 30
When the application crash(exit without executing the deregister ),the application will be in the critical status on consul ui and never be removed by consul.
I read the code and found that the other parameters are ignored when the ttl are enable.
public static NewService.Check createCheck(Integer port, HeartbeatProperties ttlConfig,
ConsulDiscoveryProperties properties) {
NewService.Check check = new NewService.Check();
if (ttlConfig.isEnabled()) {
check.setTtl(ttlConfig.getTtl());
return check;
}
...
return check;
}
So my question is: Why the DeregisterCriticalServiceAfter is ignored.
Since it is not conflict with the ttl. And I check the consul.io document.
I alse test with the following curl script.The application:test-critical will be removed by consul automatically after 1 minute
curl -X "PUT" "http://localhost:8500/v1/agent/service/register" \
-H 'Content-Type: application/json' \
-d $'{
"ID": "test-critical-9e7433ac909aaf67ce256818b8e14e28",
"Address": "10.0.11.179",
"Name": "test-critical",
"Check": {
"TTL": "20s",
"DeregisterCriticalServiceAfter": "1m"
},
"Port": 8080
}'
Activity
spencergibb commentedon Jan 29, 2019
I think that the
consul-api
library used to only support oneCheck
, that is not the case anymore.nikotung commentedon Jan 29, 2019
I know the
consul-api
library used to only support oneCheck
. I think that theDeregisterCriticalServiceAfter
is kind of consul agent behavior, and no matter what kind ofcheck
we specified ,theDeregisterCriticalServiceAfter
should not be ignored when it is config.scrat98 commentedon Feb 20, 2019
Same issue. Could you please add DeregisterCriticalServiceAfter feature on TTL checks. Thanks!
spencergibb commentedon Feb 20, 2019
@scrat98 PRs welcome
Service health check ttl with critical timeout (spring-cloud#490)
3 remaining items