Skip to content

OpenTelemetryDataSource error when refresh configuration #13512

@kkz-01

Description

@kkz-01

Describe the bug
When using nacos to refresh the configuration, the OpenTelemetryDataSource reports an error and the configuration refresh does not take effect

Steps to reproduce
Use pom.xml to import opentelemetry-instrumentation-bom(v2.12.0) and opentelemetry-spring-boot-starter then use nacos to modify the configuration

What did you expect to see?
OpenTelemetryDataSource does not report an error and can obtain the correct constructor, Configuration refresh works fine

What did you see instead?
Refresh configuration failed. Through debug, found the error ExistingValue must be an instance of com.zaxxer.hikari.HikariDataSource.

It seems that SpringBoot cannot get the correct constructor of OpenTelemetryDataSource well.

What version and what artifacts are you using?

  • opentelemetry-instrumentation-bom(v2.12.0)
  • opentelemetry-spring-boot-starter
  • nacos-client(v2.3.2)
  • SpringBoot(v3.2.7)
  • use pom.xml to reference artifacts

Environment
Windows 10

Additional context
Through debug I got some information

The entrance is nacos-client, but the final error is due to the constructor method error returned by OpenTelemetryDataSource

error:

Image

entrance:

Image

I have been tracking the problem through debug and found the method link is as follows:

CacheData(nacos-client) -> publish RefreshEvent by ApplicationContext -> SimpleApplicationEventMulticaster#invokeListener (spring-context) -> ... -> ConfigurationPropertiesRebinder#onApplicationEvent -> ... -> ConfigurationPropertiesRebinder#rebind(String name, ApplicationContext appContext) -> initializeBean#initializeBean -> ... -> ConfigurationPropertiesBean#get which Causes an error

Image

beacause of the findFactoryMethod returns the wrong construction method, it causes an error in bindTarget = bindTarget.withExistingValue(bean);

Image

and i find that if factoryMethod return null. in ConfigurationPropertiesBean#createBindTarget it can return correct Constructor

Image

finally catch by ConfigurationPropertiesRebinder#rebind

Image

This looks like a bug right?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions