You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a custom MeterRegistryCustomizer to add a default tag (micrometer provided) to all the metrics.
The bug
What's the problem? What's not working? What do you expect to happen.
Expect the custom tag to be added to all the metrics captured by the application. However, when adding this library, the custom tags are not added. Excluding certain AutoConfiguration classes (e.g. GrpcClientMetricAutoConfiguration) causes the tags to be added. It seems, these tags are skipped before MeterRegistryPostProcessor is able to post-process the MeterRegistry bean and add MeterRegistryCustomizer logic.
Stacktrace and logs
Is there a stacktrace or a hint in the logs? (very important)
Screenshots work as well, but don't screenshot your logs.
"Bean 'metricsClientInterceptor' of type [net.devh.boot.grpc.client.metrics.MetricsClientInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'net.devh.boot.grpc.client.autoconfigure.GrpcClientMicrometerTraceAutoConfiguration' of type [net.devh.boot.grpc.client.autoconfigure.GrpcClientMicrometerTraceAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration' of type [org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'observationRegistry' of type [io.micrometer.observation.SimpleObservationRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'globalObservationClientInterceptorConfigurer' of type [io.micrometer.core.instrument.binder.grpc.ObservationGrpcClientInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'grpcClientConfig' of type [in.dailyhunt.reco.service.interceptor.GrpcClientConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'customInterceptor' of type [in.dailyhunt.reco.service.interceptor.UserProfileServiceClientInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'asyncStubFactory' of type [net.devh.boot.grpc.client.stubfactory.AsyncStubFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'blockingStubFactory' of type [net.devh.boot.grpc.client.stubfactory.BlockingStubFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'futureStubFactory' of type [net.devh.boot.grpc.client.stubfactory.FutureStubFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies."
Use the library to implement a GrpcClient implementation.
Start the application with @SpringBootApplication(exclude = {GrpcClientMetricAutoConfiguration.class}) and without. When starting with the auto-configure classes excluded, the tag 'host' and 'module' are added to all metrics. If we do not exclude the autoconfigure classes, the metrics do not carry these tags.
The application's environment
Which versions do you use?
Spring (boot): 3.2.3
grpc-java: 1.47.0
grpc-spring-boot-starter: 3.1.0.RELEASE
java: version + architecture (64bit?) 21, linux-x64 and aarch64
Other relevant libraries... spring-boot-actuator and prometheus
Additional context
Did it ever work before? Not sure.
Do you have a demo? Not immediately but should be easy to create one.
The text was updated successfully, but these errors were encountered:
It happens because GrpcClientBeanPostProcessor initializes beans (like interceptors) eagerly in @PostConstruct, it makes every dependency (including transitive) being unavailable for post processing.
It can prevent exporters like prometheus to be initialized properly, because it's also done via BeanPostProcessor
I have the same problem. With the GrpcClientMetricAutoConfiguration, the JVM metrics are not returned.
When I start the application with @SpringBootApplication(exclude = {GrpcClientMetricAutoConfiguration.class}), then the JVM metrics are returned. For example, the metric system_load_average_1m:
I have Spring Boot 3.4.1, Spring Cloud 2024.0.0 and grpc-client-spring-boot-starter 3.1.0.RELEASE.
It would be nice to have a workaround where I can have the JVM (and other) metrics and the gRPC metrics.
The context
Added a custom MeterRegistryCustomizer to add a default tag (micrometer provided) to all the metrics.
The bug
What's the problem? What's not working? What do you expect to happen.
Expect the custom tag to be added to all the metrics captured by the application. However, when adding this library, the custom tags are not added. Excluding certain AutoConfiguration classes (e.g. GrpcClientMetricAutoConfiguration) causes the tags to be added. It seems, these tags are skipped before MeterRegistryPostProcessor is able to post-process the MeterRegistry bean and add MeterRegistryCustomizer logic.
Stacktrace and logs
Is there a stacktrace or a hint in the logs? (very important)
Screenshots work as well, but don't screenshot your logs.
"Bean 'metricsClientInterceptor' of type [net.devh.boot.grpc.client.metrics.MetricsClientInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'net.devh.boot.grpc.client.autoconfigure.GrpcClientMicrometerTraceAutoConfiguration' of type [net.devh.boot.grpc.client.autoconfigure.GrpcClientMicrometerTraceAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration' of type [org.springframework.boot.actuate.autoconfigure.observation.ObservationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'observationRegistry' of type [io.micrometer.observation.SimpleObservationRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'globalObservationClientInterceptorConfigurer' of type [io.micrometer.core.instrument.binder.grpc.ObservationGrpcClientInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'grpcClientConfig' of type [in.dailyhunt.reco.service.interceptor.GrpcClientConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'customInterceptor' of type [in.dailyhunt.reco.service.interceptor.UserProfileServiceClientInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'asyncStubFactory' of type [net.devh.boot.grpc.client.stubfactory.AsyncStubFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'blockingStubFactory' of type [net.devh.boot.grpc.client.stubfactory.BlockingStubFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies.", "Bean 'futureStubFactory' of type [net.devh.boot.grpc.client.stubfactory.FutureStubFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [grpcClientBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies."
Steps to Reproduce
Steps to reproduce the behavior:
@Bean MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() { return registry -> registry.config().commonTags(Tags.of("host", "host-1").and("module", "mymodule")); }
@SpringBootApplication(exclude = {GrpcClientMetricAutoConfiguration.class})
and without. When starting with the auto-configure classes excluded, the tag 'host' and 'module' are added to all metrics. If we do not exclude the autoconfigure classes, the metrics do not carry these tags.The application's environment
Which versions do you use?
Additional context
The text was updated successfully, but these errors were encountered: