Micrometer logs java.lang.NullPointerException with Scheduled tasks #4507
Labels
for: external-project
For an external project and not something we can fix
invalid
An issue that we don't feel is valid
Describe the bug
Logs are flooded with Micrometer null pointer errors when used with Scheduled tasks in spring boot.Refer full trace of logs under additional context section. Have given a simple example of how to replicate the issue
at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
at io.micrometer.common.ImmutableKeyValue.(ImmutableKeyValue.java:38) ~[micrometer-commons-1.12.0.jar:1.12.0]
Environment
java -version
]openjdk 17.0.6 2023-01-17 LTS
OpenJDK Runtime Environment Corretto-17.0.6.10.1 (build 17.0.6+10-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.6.10.1 (build 17.0.6+10-LTS, mixed mode, sharing)
To Reproduce
How to reproduce the bug:
Refer this example app -> https://github.com/cloudbackenddev/demoapp
Expected behavior
No nullpointer errors are expected
Additional context
Full trace of the errot
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
at io.micrometer.common.ImmutableKeyValue.(ImmutableKeyValue.java:38) ~[micrometer-commons-1.12.0.jar:1.12.0]
at io.micrometer.common.KeyValue.of(KeyValue.java:48) ~[micrometer-commons-1.12.0.jar:1.12.0]
at io.micrometer.common.KeyValue.of(KeyValue.java:58) ~[micrometer-commons-1.12.0.jar:1.12.0]
at org.springframework.scheduling.support.DefaultScheduledTaskObservationConvention.codeNamespace(DefaultScheduledTaskObservationConvention.java:64) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.scheduling.support.DefaultScheduledTaskObservationConvention.getLowCardinalityKeyValues(DefaultScheduledTaskObservationConvention.java:56) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.scheduling.support.DefaultScheduledTaskObservationConvention.getLowCardinalityKeyValues(DefaultScheduledTaskObservationConvention.java:31) ~[spring-context-6.1.1.jar:6.1.1]
at io.micrometer.observation.SimpleObservation.start(SimpleObservation.java:152) ~[micrometer-observation-1.12.0.jar:1.12.0]
at io.micrometer.observation.Observation.observe(Observation.java:497) ~[micrometer-observation-1.12.0.jar:1.12.0]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:124) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-6.1.1.jar:6.1.1]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
The text was updated successfully, but these errors were encountered: