-
Notifications
You must be signed in to change notification settings - Fork 913
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
OpenTelemetryDataSource error when refresh configuration #13512
Comments
transferred to opentelemetry-java-instrumentation repo where the spring boot starter lives |
@kkz-01 Could you please provide a small repro with the detailed steps to reproduce the issue? It would help investigate. |
@jeanbisutti you can find code in repository |
I looked the code of opentelemetry-spring-boot-starter and found that OpenTelemetryDataSource wraps the data source through DataSourcePostProcessor#postProcessAfterInitialization but does not inject it into the container. I think the easiest way to fix this problem is to inject OpenTelemetryDataSource into the container through |
Because |
Describe the bug
When using nacos to refresh the configuration, the
OpenTelemetryDataSource
reports an error and the configuration refresh does not take effectSteps to reproduce
Use pom.xml to import
opentelemetry-instrumentation-bom
(v2.12.0) andopentelemetry-spring-boot-starter
then use nacos to modify the configurationWhat did you expect to see?
OpenTelemetryDataSource
does not report an error and can obtain the correct constructor, Configuration refresh works fineWhat 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 ofOpenTelemetryDataSource
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)pom.xml
to reference artifactsEnvironment
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:
entrance:
I have been tracking the problem through debug and found the method link is as follows:
CacheData
(nacos-client
) -> publishRefreshEvent
byApplicationContext
->SimpleApplicationEventMulticaster#invokeListener
(spring-context
) -> ... ->ConfigurationPropertiesRebinder#onApplicationEvent
-> ... ->ConfigurationPropertiesRebinder#rebind(String name, ApplicationContext appContext)
->initializeBean#initializeBean
-> ... ->ConfigurationPropertiesBean#get
which Causes an errorbeacause of the
findFactoryMethod
returns the wrong construction method, it causes an error inbindTarget = bindTarget.withExistingValue(bean);
and i find that if
factoryMethod
return null. inConfigurationPropertiesBean#createBindTarget
it can return correct Constructorfinally catch by
ConfigurationPropertiesRebinder#rebind
This looks like a bug right?
The text was updated successfully, but these errors were encountered: