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

Application start fails with NullPointerException because of MicrometerRecorder changes (3.3.0) #35443

Closed
holomekc opened this issue Aug 21, 2023 · 5 comments · Fixed by #35463
Labels
area/metrics kind/bug Something isn't working
Milestone

Comments

@holomekc
Copy link
Contributor

holomekc commented Aug 21, 2023

Describe the bug

With Quarkus 3.3.0 our application cannot start anymore and fails with a NullPointerException:

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because "classSpecificCustomizers" is null
	at io.quarkus.micrometer.runtime.MicrometerRecorder.configureRegistries(MicrometerRecorder.java:99)
	at io.quarkus.deployment.steps.MicrometerProcessor$configureRegistry477897979.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.MicrometerProcessor$configureRegistry477897979.deploy(Unknown Source)

We have a custom MeterRegistry (DynatraceMeterRegistry). We configured it exactly like this:
https://quarkus.io/guides/telemetry-micrometer#create-a-customized-meterregistry

After debugging I could see that registryClasses

Only contains two registries:

  • PrometheusMeterRegistry
  • JsonMeterRegistry

But in this line:

Set<Bean<?>> beans = new HashSet<>(beanManager.getBeans(MeterRegistry.class, Any.Literal.INSTANCE));

Quarkus finds three beans:

  1. PrometheusMeterRegistryProducer...
  2. JsonMeterRegistryProvider...
  3. DynatraceMicrometerRegistry...

The loop over the beans with three entries then tries to find the classSpecificCustomizers for DynatraceMeterRegistry:

var classSpecificCustomizers = classMeterRegistryCustomizers.get(registryClass);

This returns null, which results in a NullPointerException in line:

globalMeterRegistryCustomizers.size() + classSpecificCustomizers.size());

Expected behavior

Our application can start as usual 😉 .

Actual behavior

See bug description.

How to Reproduce?

See bug description.

Output of uname -a or ver

Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64

Output of java -version

openjdk 17.0.7 2023-04-18 LTS

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.3.0

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.9.2

Additional information

No response

@holomekc holomekc added the kind/bug Something isn't working label Aug 21, 2023
@holomekc
Copy link
Contributor Author

I could find that these changes are introduced here:
fbd6e52#diff-60163295574610b7cbe78ad23a4f19555ed7cc535df755adda53998976c6279e

because of:
#32996

@holomekc holomekc changed the title Application start fails with NullPointerException because of MicroneterRecorder changes (3.3.0) Application start fails with NullPointerException because of MicrometerRecorder changes (3.3.0) Aug 21, 2023
@mkouba
Copy link
Contributor

mkouba commented Aug 22, 2023

CC @geoand

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 22, 2023

/cc @brunobat (micrometer), @ebullient (metrics,micrometer), @jmartisk (metrics)

@geoand
Copy link
Contributor

geoand commented Aug 22, 2023

Ouch... What a silly mistake on my part!

I'll fix it ASAP, sorry for the inconvenience.

@geoand
Copy link
Contributor

geoand commented Aug 22, 2023

If however you can provide a sample application, we can make sure that nothing else broke as well.

geoand added a commit to geoand/quarkus that referenced this issue Aug 22, 2023
geoand added a commit that referenced this issue Aug 22, 2023
Fix potential NPE in MicrometerRecorder
@quarkus-bot quarkus-bot bot added this to the 3.4 - main milestone Aug 22, 2023
@gsmet gsmet modified the milestones: 3.4 - main, 3.3.1 Aug 26, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 26, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants