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

Spring boot runtime metrics naive reduced multi config #13236

Conversation

zeitlinger
Copy link
Member

Variant of #13173

@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Feb 6, 2025
@zeitlinger zeitlinger closed this Feb 6, 2025
@zeitlinger zeitlinger reopened this Feb 6, 2025
import java.util.logging.Logger;

/** The entry point class for runtime metrics support using JMX. */
public final class RuntimeMetrics implements Closeable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor)

Having two RuntimeMetrics classes (Java 8 and Java 17) has confused me.

Perhaps renamed this one into Java8RuntimeMetrics?

Same comment for RuntimeMetricsBuilder.

Copy link
Member Author

@zeitlinger zeitlinger Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these classes were not introduced by this PR - let's do it separately

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds RuntimeMetrics and RuntimeMetricsBuilder classes for Java 17. So, these class names exist both for the Java 8 and Java 17 runtime metrics implementations.

Copy link
Member Author

@zeitlinger zeitlinger Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok - renamed (in #13173)

zeitlinger and others added 2 commits February 6, 2025 18:33
…/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/runtimemetrics/Java17RuntimeMetricsAutoConfiguration.java

Co-authored-by: Jean Bisutti <[email protected]>
@zeitlinger
Copy link
Member Author

Closed - see #13245

@zeitlinger zeitlinger closed this Feb 7, 2025
@zeitlinger zeitlinger reopened this Feb 7, 2025
static class OlderThanJava17 {}

// GraalVM native image does not support Java 17 metrics yet
@ConditionalOnProperty("org.graalvm.nativeimage.imagecode")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Java 8 runtime metrics does not work on native mode.

What would happen is that Java8MetricsCondition is not verified in the Spring AOT step because org.graalvm.nativeimage.imagecode does not exist (JVM execution). The Java classes resulting from AOT may not then contain the startMetricsForJava8 bean. So, the Java native application may not also contain this bean.

We could explore solutions to detect that the AOT step is under execution or to include by default the startMetricsForJava8 in the AOT step.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeitlinger I would suggest to go ahead with #13173 (and perhaps close this PR).

@zeitlinger zeitlinger closed this Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants