3

/health エンドポイントを有効にしましたが、同じマシン上で Consul によって監視されているすべてのサービスを一覧表示したくありません。

これは私のapplication.propertiesです:

# Enable just the health endpoint.
endpoints.health.enabled=true

# Disable all default endpoints and Spring Cloud endpoints.
endpoints.enabled=false
endpoints.consul.enabled=false
endpoints.pause.enabled=false
endpoints.resume.enabled=false
endpoints.refresh.enabled=false
endpoints.restart.enabled=false
endpoints.shutdown.enabled=false
endpoints.env.enabled=false

management.health.db.enabled=false
management.health.diskspace.enabled=false
management.health.defaults.enabled=false

...そして、これは /health が現在出力しているものです:

$ curl -o- http://localhost:8080/health | python -m json.tool
{
    "consul": {
        "advertiseAddress": "10.10.10.10", 
        "bindAddress": "10.10.10.10", 
        "clientAddress": "127.0.0.1", 
        "datacenter": "DC", 
        "domain": "consul.", 
        "nodeName": "mynode", 
        "services": {
            "myservice1": [
                "tag1"
            ], 
            "myservice2": [
                "tag1", 
                "tag2"
            ]
        }, 
        "status": "UP"
    }, 
    "description": "Spring Cloud Consul Discovery Client", 
    "discoveryComposite": {
        "description": "Spring Cloud Consul Discovery Client", 
        "discoveryClient": {
            "description": "Spring Cloud Consul Discovery Client", 
            "services": [
                "myservice1",
                "myservice2"
            ], 
            "status": "UP"
        }, 
        "status": "UP"
    }, 
    "status": "UP"
}

は気にしませんが、その下に"description": "Spring Cloud Consul Discovery Client"ある残りのものは公開したくないものです。"consul""discoveryComposite"/health

これらの情報をこのエンドポイントに追加するのは何ですか?

4

3 に答える 3

11

これは、Spring Cloud Commons から来ています。

discoveryCompositeプロパティの設定を無効にしますspring.cloud.discovery.client.composite-indicator.enabled=false

もう一方に設定management.health.consul.enabled=falseします。

于 2017-01-12T19:15:08.657 に答える