Prometheus:发现的服务地址是空的?

编程入门 行业动态 更新时间:2024-10-26 08:33:06
本文介绍了Prometheus:发现的服务地址是空的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我编写了一个非常基本的 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 吗?

Any idea why __address__ is :0?

推荐答案

Serverset 发现是一个 使用 Zookeeper 的特定方式,您的应用程序未遵循该方式.在这种情况下,您可能需要 文件服务发现.

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

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

更多推荐

[db:关键词]

本文发布于:2023-04-18 17:32:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/943625.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地址   发现   Prometheus

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!