Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've written a very basic Spring Boot 2 application that connects to Zookeeper for service discovery (by using spring-cloud-starter-zookeeper-discovery).

The application gets registered at /services/example-service with the following value:

{"name":"example-service","id":"cb14ad15-4d33-4f1c-a420-29980ddf2fa8","address":"bf3fb9191373","port":8080,"sslPort":null,"payload":{"@class":"org.springframework.cloud.zookeeper.discovery.ZookeeperInstance","id":"application-1","name":"example-service","metadata":{}},"registrationTimeUTC":1524120820273,"serviceType":"DYNAMIC","uriSpec":{"parts":[{"value":"scheme","variable":true},{"value":"://","variable":false},{"value":"address","variable":true},{"value":":","variable":false},{"value":"port","variable":true}]}}

The address is an id because I've deployed the stack with Docker.

My Prometheus configuration looks like this:

- job_name: 'example-service'
  metrics_path: '/actuator/prometheus'
  serverset_sd_configs:
  - servers:
    - zookeeper:2181
    paths:
    - '/services/example-service'

The service discovery page of Prometheus shows the following discovered labels:

__address__=":0"  __meta_serverset_endpoint_host=""  __meta_serverset_endpoint_port="0" __meta_serverset_path="/services/example-service/cb14ad15-4d33-4f1c-a420-29980ddf2fa8"  __meta_serverset_shard="0"  __meta_serverset_status="" __metrics_path__="/actuator/prometheus"  __scheme__="http"  job="example-service"

Any idea why __address__ is :0?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
262 views
Welcome To Ask or Share your Answers For Others

1 Answer

Serverset discovery is a particular way of using Zookeeper, which your application is not following. In this case you probably want file service discovery.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...