micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.45k stars 980 forks source link

Add explicit module-info #4990

Open bowbahdoe opened 4 months ago

bowbahdoe commented 4 months ago

Please describe the feature request.

This is a follow up to #1242 which gave a stable module name. The next step is to add an actual module descriptor.

Rationale

To be able to use jlink, everything on your dependency tree needs to be an explicit module.

This is the graph of what spring-web brings in. Red is no module info, Yellow is automatic module info, Green is full module descriptor. I am working through all the artifacts which are not maintained by Spring to see what I can do.

image

Additional context

There are 3 broad ways to do this.

  1. Bump the entire project to a higher Java version. Add a module-info.java, update build plugins, etc.
  2. Set up multi-release jars with a folder for "java 9" code where we put a module-info and configure the build
  3. Use the moditect plugin to generate a module info

The first is the best but has an obvious cost to it. The second and third I am used to setting up on Maven for folks. Nowhere near as comfortable with Gradle.

shakuzen commented 4 months ago

Bump the entire project to a higher Java version.

This isn't possible without a new major version. I don't foresee that happening anytime soon.

Isn't a prerequisite of adding an explicit module-info.java that all dependencies we declare have at least an automatic module name? In micrometer-core, I see our dependencies don't:

image

We will have the same issue with some of the registry modules that have external dependencies.

bowbahdoe commented 4 months ago

This isn't possible without a new major version. I don't foresee that happening anytime soon.

Ways 2 or 3 it is.

Isn't a prerequisite of adding an explicit module-info.java that all dependencies we declare have at least an automatic module name? In micrometer-core, I see our dependencies don't:

Okey dokie. Further into the mines I go.

I opened a PR on HDR histogram. Its last release was 4 years ago and they do have an automatic module name in their POM so maybe there just hasn't been a release since that.

After that, LatencyUtils (since it depends on HdrHistogram) https://github.com/LatencyUtils/LatencyUtils

A non-trivial part will be having those folks make maven central releases too.

We will have the same issue with some of the registry modules that have external dependencies.

One thing at a time I guess.

giltene commented 4 months ago

@bowbahdoe HdrHistogram 2.2.1 is now released to maven central with your PR integrated. I can also do the same to LatencyUtils if you open a PR there.

obfischer commented 3 weeks ago

+1 from me for this feature request. I am building a command line application with jlink and currently I have to generate for each dependency without a module info a custom one with the help of moditect.

shakuzen commented 3 weeks ago

I don't think we're opposed to doing this, but the ecosystem (our dependencies) still need to catch up, as far as I understand. This will be especially challenging if all of the optional dependencies we have (a lot) need an explicit or automatic module. I'm not sure on that point about optional dependencies, though.

bowbahdoe commented 3 weeks ago

@shakuzen I'm working through it at the speed i am able. HDRHistogram is the one that needs to go first. they hit a bug in moditect i need to check if its fixed

obfischer commented 3 weeks ago

Hi all, I don‘t have any doubt, that you are on it. I simply added my comment to document, that there is a need for this feature in the real world ;-)