Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义Prometheus拉取客户端的端口号失效 #1303

Closed
wchappygood opened this issue May 24, 2024 · 14 comments
Closed

自定义Prometheus拉取客户端的端口号失效 #1303

wchappygood opened this issue May 24, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@wchappygood
Copy link

wchappygood commented May 24, 2024

版本:
1.12.4-2021.0.8

spring.cloud.polaris.stat.port设置成28085

image

Tasks

No tasks being tracked yet.
@wchappygood wchappygood added the bug Something isn't working label May 24, 2024
@wchappygood
Copy link
Author

image
这个对象初始化的时候,
image
这个对象还没初始化导致,配置没有修改到

@wchappygood
Copy link
Author

找到原因了
image

@SkyeBeFreeman
Copy link
Collaborator

如果使用bootstrap.yml做配置,需指定spring.cloud.polaris.enabled为true。

@wchappygood
Copy link
Author

wchappygood commented May 24, 2024

如果使用bootstrap.yml做配置,需指定spring.cloud.polaris.enabled为true。

我说下我的理解不知道对不对:
配置PolarisConfigBootstrapAutoConfiguration在bootstrap阶段就会创建PolarisContext,并把PolarisConfigModifier处理了,
而StatConfigModifier并非是bootstrap阶段,所以就无法修改配置了。

所以现在有没什么其他方法方法可以用配置中心的配置去修改配置,达到自定义端口的效果

@SkyeBeFreeman
Copy link
Collaborator

有PolarisStatPropertiesBootstrapConfiguration,那么bootstrap阶段,StatConfigModifier应该会生效才对

@SkyeBeFreeman
Copy link
Collaborator

在你的bootstrap.yml下加一个这个配置试试呢?

spring:
  config:
    import: optional:polaris

@wchappygood
Copy link
Author

wchappygood commented May 27, 2024

PolarisStatPropertiesBootstrapConfiguration

image
需要手动设置这个值才能生效
但是还是不能读取配置中心的配置来设置端口

@wchappygood
Copy link
Author

在你的bootstrap.yml下加一个这个配置试试呢?

spring:
  config:
    import: optional:polaris

不得行,还是无法读取配置中心的配置设置端口

@SkyeBeFreeman
Copy link
Collaborator

@wchappygood 如下配置无法设置远端配置的端口吗?我这里尝试是可以的。

spring:
  config:
    import: optional:polaris
  cloud:
    polaris:
      enbaled: true

@wchappygood
Copy link
Author

@wchappygood 如下配置无法设置远端配置的端口吗?我这里尝试是可以的。

spring:
  config:
    import: optional:polaris
  cloud:
    polaris:
      enbaled: true

可以改变。但是只能通过配置在bootstrap.yml才能生效。

@SkyeBeFreeman
Copy link
Collaborator

SkyeBeFreeman commented May 31, 2024

@wchappygood 你的诉求是,这个配置也只通过远程配置吗?

spring:
  cloud:
    polaris:
      enbaled: true

bootstrap.yml只留?

spring:
  config:
    import: optional:polaris

@wchappygood
Copy link
Author

wchappygood commented May 31, 2024

@wchappygood 你的诉求是,这个配置也只通过远程配置吗?

spring:
  cloud:
    polaris:
      enbaled: true

bootstrap.yml只留?

spring:
  config:
    import: optional:polaris

我们的诉求是spring.cloud.polaris.stat.port这个可以配置在配置中心,我们用bootstrap.yml启动的

@SkyeBeFreeman
Copy link
Collaborator

@wchappygood 我用这个配置,是可以支持你的需求的。
应用内bootstrap.yml:

spring:
  config:
    import: optional:polaris
  cloud:
    polaris:
      enbaled: true

配置中心:
image

@wchappygood
Copy link
Author

spring.cloud.polaris.stat.port

谢谢成功了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants