Consul is using health endpoints to determine whether service instance is healthy. If you want custom health status which considers some custom metrics you should implement HealthIndicator interface.
You can expose more information in health api by setting management.security.enabled=false
in application.properties
In this case you'll see something like this in consul admin UI for your service
HTTP GET http://192.168.0.102:8080/health: 200 Output: {"description":"Composite Discovery Client","status":"UP","discoveryComposite":{"description":"Composite Discovery Client","status":"UP","discoveryClient":{"description":"Composite Discovery Client","status":"UP","services":["application","consul"]}},"diskSpace":{"status":"UP","total":499963170816,"free":341478899712,"threshold":10485760},"consul":{"status":"UP","leader":"127.0.0.1:8300","services":{"application":[],"consul":[]}},"hystrix":{"status":"UP"}}
You can configure health URL to different endpoint. For instance if you specify spring.cloud.consul.discovery.healthCheckPath=/health2
then your spring-boot instance will register with the following json (see log snippet below):
Registering service with consul: NewService{id='application', name='application', tags=[], address='192.168.0.102', port=8080, enableTagOverride=null, check=Check{script='null', interval='10s', ttl='null', http='http://192.168.0.102:8080/health2', tcp='null', timeout='null', deregisterCriticalServiceAfter='null', tlsSkipVerify=null, status='null'}, checks=null}