Open SOOHYUN-LIM opened 1 year ago
Can you please add a test for this?
I have modified the code to ensure that each dependency injection method works correctly, taking into consideration the Spring lifecycle. Also added test code to verify if metric information registration is done successfully.
Thanks, I will have a look when I have some spare time.
hey @ST-DDT @SOOHYUN-LIM I know this PR might potentially be out of date now, but any update on getting this fix in?
@abhathal No, I haven't received any feedback yet. @ST-DDT When can i expect confirmation?
Could you please resolve the merge conflict?
@ST-DDT I resolved the merge conflict
@ST-DDT I resolved the merge conflict
Thanks, I will get to it shortly.
It looks like there is a compile error.
@ST-DDT Sorry, Please build it again
Is there an estimated timeline for merging this pull request? In addition to metrics, it is also affecting tracing.
Sorry for the delay. @ST-DDT As you mentioned, relocating initGrpClientConstructorInjections() would resolve the issue. However, given the potential for bugs due to the order of bean registrations, I proceeded with improvement efforts.
During the initialization of LoadTimeWeaverAware (LTW), I performed the initialization of the grpc client BEAN. This ensures that at that point of initialization, any potential issues arising from other associated beans being registered in unintended orders are prevented.
It has been confirmed that initialization occurs only once. Could you please provide an explanation once again?
@ST-DDT @SOOHYUN-LIM Is there an estimated timeline for merging this pull request?
If somebody else approves it.
@ST-DDT @SOOHYUN-LIM bumping the question on when this PR might be merged
@yidongnan Can you please name a person that can review/approve PRs for this repository going forward?
Issue: https://github.com/yidongnan/grpc-spring-boot-starter/issues/859
According to the order of registering Spring beans, there is an issue with the constructor injection of the Grpc Client. When creating the GrpcClientBeanPostProcessor bean, the constructor injection of the "Grpc Client" is performed by the @PostConstruct. During this process, when creating the GlobalGrpcClientInterceptor and its associated beans (MetricsBeanPostProcessor, Prometheus, etc.), the initialized "BeanPostProcessor" is not yet registered (nonOrdered), causing metrics to not be properly registered.
Therefore, it is necessary to change the order of bean registration by using InternalPostProcessors, similar to the AutowiredAnnotationBeanPostProcessor in Spring and the PersistenceAnnotationBeanPostProcessor in JPA. The task has been carried out along with the same validation as Spring's dependency injection, and it allows for identifying more specific errors.