Open paul-kraftlauget opened 1 year ago
@srnagar could you please follow up?
I have fixed the blocking calls reported in AsyncRestProxy
in this PR.
@saragluna could you please take a look at updating the health indicators to use AbstractReactiveHealthIndicator
in Spring libraries?
Thanks @srnagar!
Hi @paul-kraftlauget, are you defining your own AzureXXXReactiveHealthIndicator
classes in your project? Why I am asking this is to decide whether to switch our health indicator to reactive implementations.
Referring to Spring Boot's configuration for imperative and reactive health indicators, they will inject the reactive health indicator beans if the Flux.class
is on the classpath. For Azure's case, azure-core
depends on reactor-core, which means the Flux.class
will always be there.
See https://github.com/spring-projects/spring-boot/issues/29107, and https://github.com/spring-projects/spring-boot/issues/22692.
Defaulting to reactive won't be an issue. But if users want to explicitly use the imperative implementation, they need to provide the bean.
Sorry for the late reply.
Yes, I have seen the way Spring has chosen to do the autoconfiguration discovery, and just including azure SDK already activates all the reactive health indicators then. My application is actually sort of a half / half application as input is not received from REST but from other sources (JMS). It doesn't use WebFlux, but it is a fully reactive application when processing the messages. My unit tests for the entire Spring application context include reading actuator's health check and these unit tests failed with blockhound enabled. Any custom health indicators I have written for the application have been reactive health indicators, which work just fine even when the application is not WebFlux.
So then, I would suggest to just follow Spring's implementation pattern here.
If you want to give people the option, just add an 'enabled' config flag so reactive health indicators can be disabled.
@paul-kraftlauget, so I will add this feature request to our backlog since based on what I have read, the issue blocking your project has been resolved.
Describe the bug
When using a WebFlux application, health indicators should extend
org.springframework.boot.actuate.health.AbstractReactiveHealthIndicator
and avoid callingMono.block()
.Furthermore, even if refactored, blockhound reports some blocking calls during the health check that need to be removed (for example,
StorageBlobHealthIndicator
,StorageQueueHealthIndicator
, see stacktrace below).Exception or Stack Trace
To Reproduce
Steps to reproduce the behavior:
Change health indicators to extend org.springframework.boot.actuate.health.AbstractReactiveHealthIndicator and add blockhound library to test classpath to discover blocking invocation.
Expected behavior
The Azure SDK should automatically discover a WebFlux application and initialize reactive health indicators for all health indicators. An application using both Azure SDK and blockhound should not fail on azure SDK's blocking implementations (for example, load classes containing blocking calls during spring startup and not during health indicator execution).