Dependency cycle between micrometer-core and reactor-netty caused by ReactorNettySender
#2802
Labels
bug
A general bug
module: micrometer-core
An issue that is related to our core module
release notes
Noteworthy change to call out in the release notes
Milestone
Describe the bug
We have a dependency cycle caused by having the
ReactorNettySender
implementation in micrometer-core, which forces an optional dependency on reactor-netty. For it's own metrics instrumentation, reactor-netty has an optional dependency on micrometer-core. This is a cycle, with which we've mostly avoided problems by not using new API in either place and so there's no need to upgrade to the latest version. This is not a viable long-term strategy, however.Environment
Expected behavior
No dependency cycles and a clear expectation of which project needs to release first based on non-cyclic dependencies.
Potential solutions
ReactorNettySender
is the only class in micrometer-core that depends on reactor-netty. What might we do with it?For the first option, it's not clear how much
ReactorNettySender
would be missed if we tried to get rid of it. It is not the defaultHttpSender
implementation, and it requires reactor-netty. Furthermore, to abide by theHttpSender
API that requires returning aResponse
in thesend
method, it uses the anti-pattern of calling theblock
method on the reactor-nettyHttpClient
. I don't know if this is a problem in practice given the limited usage of the sender in Micrometer. We can't easily switch to idiomatic reactor usage because of the API ofHttpSender
and the point of this issue being to avoid a dependency on reactor in micrometer-core.Moving the
ReactorNettySender
class to Reactor Netty would be a way to allow continued use of it while breaking the current cycle.Additional context
As we are preparing for Micrometer 2.0 development, this dependency cycle becomes a critical issue, since Micrometer or Reactor Netty needs to release first for the other to depend on it, but both can't happen with a dependency cycle.
Separately from the micrometer-core ↔ reactor-netty cycle, we have another cycle because micrometer-registry-statsd has a shaded dependency on reactor-netty and is released together with micrometer-core in this same repository. This issue is focused on only the cycle directly in micrometer-core.
The text was updated successfully, but these errors were encountered: