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

Auto-configure VirtualThreadMetrics #43852

Closed
wants to merge 1 commit into from
Closed

Conversation

nosan
Copy link
Contributor

@nosan nosan commented Jan 16, 2025

See gh-43122

I also verified these changes with a native image.

JDK

openjdk version "23.0.1" 2024-10-15
OpenJDK Runtime Environment Liberica-NIK-24.1.1-1 (build 23.0.1+13)
OpenJDK 64-Bit Server VM Liberica-NIK-24.1.1-1 (build 23.0.1+13, mixed mode, sharing)

pom.xml

<plugin>
    <groupId>org.graalvm.buildtools</groupId>
    <artifactId>native-maven-plugin</artifactId>
    <configuration>
        <buildArgs>
            <buildArg>--enable-monitoring=jfr</buildArg>
        </buildArgs>
    </configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
    <image>
        <env>
            <BP_NATIVE_IMAGE_BUILD_ARGUMENTS>--enable-monitoring=jfr</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
        </env>
    </image>
</configuration>
</plugin>

Both $ mvn -Pnative native:compile and $ mvn -Pnative spring-boot:build-image work fine.

2025-01-16T13:14:07.947Z  INFO 1 --- [gh-43122] [           main] task.gh43122.Gh43122Application          : Starting AOT-processed Gh43122Application using Java 23.0.1 with PID 1 (/workspace/task.gh43122.Gh43122Application started by cnb in /workspace)
2025-01-16T13:14:07.947Z  INFO 1 --- [gh-43122] [           main] task.gh43122.Gh43122Application          : No active profile set, falling back to 1 default profile: "default"
2025-01-16T13:14:07.959Z  INFO 1 --- [gh-43122] [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2025-01-16T13:14:07.960Z  INFO 1 --- [gh-43122] [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2025-01-16T13:14:07.961Z  INFO 1 --- [gh-43122] [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.34]
2025-01-16T13:14:07.971Z  INFO 1 --- [gh-43122] [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2025-01-16T13:14:07.971Z  INFO 1 --- [gh-43122] [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 24 ms
2025-01-16T13:14:08.025Z  WARN 1 --- [gh-43122] [           main] i.m.c.i.binder.jvm.JvmGcMetrics          : GC notifications will not be available because no GarbageCollectorMXBean of the JVM provides any. GCs=[young generation scavenger, complete scavenger]
2025-01-16T13:14:08.029Z  INFO 1 --- [gh-43122] [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 15 endpoints beneath base path '/actuator'
[warn][jfr,setting] @Deprecated JFR events, and leak profiling are not yet supported.
[warn][jfr,setting] @Deprecated JFR events, and leak profiling are not yet supported.
2025-01-16T13:14:08.090Z  INFO 1 --- [gh-43122] [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path '/'
2025-01-16T13:14:08.091Z  INFO 1 --- [gh-43122] [           main] task.gh43122.Gh43122Application          : Started Gh43122Application in 0.16 seconds (process running for 0.17)

GET http://localhost:8080/actuator/metrics
{
  "names": [
    "application.ready.time",
    "application.started.time",
    "disk.free",
    "disk.total",
    "executor.active",
    "executor.completed",
    "executor.pool.core",
    "executor.pool.max",
    "executor.pool.size",
    "executor.queue.remaining",
    "executor.queued",
    "http.server.requests.active",
    "jvm.classes.loaded",
    "jvm.classes.unloaded",
    "jvm.gc.overhead",
    "jvm.info",
    "jvm.memory.committed",
    "jvm.memory.max",
    "jvm.memory.used",
    "jvm.threads.daemon",
    "jvm.threads.live",
    "jvm.threads.peak",
    "jvm.threads.started",
    "jvm.threads.states",
    "jvm.threads.virtual.pinned",
    "jvm.threads.virtual.submit.failed",
    "logback.events",
    "process.cpu.usage",
    "process.files.max",
    "process.files.open",
    "process.start.time",
    "process.uptime",
    "ssl.chains",
    "system.cpu.count",
    "system.cpu.usage",
    "system.load.average.1m",
    "tomcat.sessions.active.current",
    "tomcat.sessions.active.max",
    "tomcat.sessions.alive.max",
    "tomcat.sessions.created",
    "tomcat.sessions.expired",
    "tomcat.sessions.rejected"
  ]
}

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 16, 2025
@mhalbritter mhalbritter added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 17, 2025
@mhalbritter mhalbritter added this to the 3.5.x milestone Jan 17, 2025
@mhalbritter mhalbritter self-assigned this Jan 24, 2025
mhalbritter pushed a commit that referenced this pull request Jan 24, 2025
See gh-43852

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
@mhalbritter mhalbritter modified the milestones: 3.5.x, 3.5.0-M2 Jan 24, 2025
@mhalbritter
Copy link
Contributor

Thanks @nosan !

@wilkinsona
Copy link
Member

Gah, sorry @nosan and @mhalbritter. I meant to comment on this to say that we should review the use of a FactoryBean. They're largely considered to be a relic of XML-based configuration and the recommendation from the Framework team is that they should be avoided. I've opened #43956 so that we don't forget to revisit this before M2 is released.

mhalbritter added a commit that referenced this pull request Jan 24, 2025
arefbehboudi pushed a commit to arefbehboudi/spring-boot that referenced this pull request Jan 29, 2025
See spring-projectsgh-43852

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
Signed-off-by: arefbehboudi <behboodiaref@gmail.com>
arefbehboudi pushed a commit to arefbehboudi/spring-boot that referenced this pull request Jan 29, 2025
See spring-projectsgh-43852

Signed-off-by: arefbehboudi <behboodiaref@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants