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

Fix java 21 #617

Merged
merged 4 commits into from
Nov 1, 2023
Merged

Fix java 21 #617

merged 4 commits into from
Nov 1, 2023

Conversation

wetted
Copy link
Contributor

@wetted wetted commented Oct 20, 2023

Supersedes #605 to stop micronaut-build force pushing it all the time

@wetted wetted self-assigned this Oct 20, 2023
@wetted wetted marked this pull request as draft October 20, 2023 19:27
@wetted
Copy link
Contributor Author

wetted commented Oct 25, 2023

This is puzzling to me. MetricsMicronautSerializationTest fails on Java 21 (passes for 17) where it expects meters with names "executor.completed", "executor.queued" but only "executor" esists. I think it has something to do with the Java 21 virtual support, but I created a project with the same test for Java 21 and it passes. I don''t know yet why it passes for my project and fails for the module. https://github.com/wetted/executor-metrics

The difference (between jdk17 and jdk21) is in what is coming from the micrometer library CompositeMetricsRegistry when MetricsEndpoint is initialized...but that still doesn't explain why my standalone example works. In that case the CompositeMetricsRegistry has the expected meters for "executor.completed" and "executor.queued".

@timyates
Copy link
Contributor

timyates commented Oct 30, 2023

So the issue seems to be that

Oct 30, 2023 10:26:47 AM io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics bindTo
WARNING: Failed to bind as java.util.concurrent.ThreadPerTaskExecutor is unsupported.

That is, it's failing to bind the metrics here in micrometer https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java#L304

This is called from our binder here:

new ExecutorServiceMetrics(unwrapped, beanIdentifier.getName(), tags).bindTo(meterRegistry);

I can't find an issue in Micrometer itself 🤔

The test passes if we turn off the virtual executor via

@Property(name = "micronaut.executors.virtual.enabled", value = "false")

on the test... but I'm not sure if this is a fix, a workaround, or a hack

And sanitize the testsuite-setialization build file
@wetted wetted marked this pull request as ready for review October 30, 2023 16:58
@wetted wetted requested a review from sdelamo October 30, 2023 16:58
Copy link

sonarqubecloud bot commented Nov 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sdelamo sdelamo merged commit 76717a6 into master Nov 1, 2023
@sdelamo sdelamo deleted the fix-java-21 branch November 1, 2023 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants