普罗米修斯:发现的服务地址为空? [英] Prometheus: Address of discovered service is empty?

查看:83
本文介绍了普罗米修斯:发现的服务地址为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个非常基本的Spring Boot 2应用程序,该应用程序连接到Zookeeper以进行服务发现(通过使用 spring-cloud-starter-zookeeper-discovery ).

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

应用程序使用以下值在/services/example-service 中注册:

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}]}}

该地址是一个id,因为我已经在Docker上部署了堆栈.

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

我的Prometheus配置如下:

My Prometheus configuration looks like this:

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

Prometheus的服务发现页面显示以下发现的标签:

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"

您知道为什么 __ address __ :0 吗?

推荐答案

服务器集发现是文件服务发现

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

这篇关于普罗米修斯:发现的服务地址为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆