Skip to content
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

reactor-core 3.2 OSGI bundle issue io.micrometer.* is not optional #1470

Closed
agjini opened this issue Dec 19, 2018 · 4 comments
Closed

reactor-core 3.2 OSGI bundle issue io.micrometer.* is not optional #1470

agjini opened this issue Dec 19, 2018 · 4 comments
Labels
type/chores A task not related to code (build, formatting, process, ...)
Milestone

Comments

@agjini
Copy link

agjini commented Dec 19, 2018

Expected behavior

When using reactor-core bundle in OSGI environment, io.micrometer.core bundle would not be required as it is an optional dependency to reactor-core.

To fix this we have to add the following line into the 'bundleImportPackages' section of build.gradle file :
'io.micrometer.*;resolution:=optional',

Actual behavior

Actually io.micrometer.core.instrument,io.micrometer.core.instrument.binder.jvm,io.micrometer.core.instrument.composite,io.micrometer.core.instrument.search are packages required at runtime. As micrometer bundle is not exporting those packages actually, it is impossible to run reactor-core >= 3.2 in OSGI env.

Steps to reproduce

Reactor Core version

reactor-core v3.2.0 and superior

JVM version (e.g. java -version)

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

@simonbasle
Copy link
Member

Have you tried with 3.2.2/3.2.2? There were some mistakes around the integration of Micrometer in 3.2.0/3.2.1...

We don't want to enforce a dependency to Micrometer for folks who are not interested in metrics, hence the optional aspect. Classes are built against at compile time, but their loading is avoided with reflection-based guards. Reactor operators involving metrics then fallback to no-op when Micrometer is not in the classpath at runtime.

If you see a way to make all this compatible with OSGI while maintaining this "no hard dependency on Micrometer" feature for users outside of the OSGI sphere, please advise.

@agjini
Copy link
Author

agjini commented Dec 19, 2018

Yes, in fact my test was made with the latest reactor-core : 3.2.3.RELEASE
I've successfully tested the fix I've mentioned (in build.gradle file) :

'io.micrometer.*;resolution:=optional',

With this fix, the bundle Import-Package section in MANIFEST.MF file reflects the optional dependency on micrometer in terms of OSGI. It is both compatible with environments inside and outside OSGI.

@simonbasle
Copy link
Member

@agjini ah got it, from the section in the issue template I thought it was supposed to work but somehow didn't... Do you want to submit a PR, or should I take care of it?

@simonbasle simonbasle added this to the 3.2.4.RELEASE milestone Dec 20, 2018
@simonbasle simonbasle added the type/chores A task not related to code (build, formatting, process, ...) label Dec 20, 2018
@agjini
Copy link
Author

agjini commented Dec 20, 2018

Thanks a lot for making the change. It would have taken more time to make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/chores A task not related to code (build, formatting, process, ...)
Projects
None yet
Development

No branches or pull requests

2 participants