-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 #9177 dump JVM info #11845
Fix #9177 dump JVM info #11845
Conversation
Fix #9177 dump info from Runtime, Jetty.VERSION and System.getProperties
runtime.freeMemory(), | ||
runtime.totalMemory(), | ||
runtime.maxMemory())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd format in MiB (so divide by 1024*1024).
I'd also see what OS it is, so sysprop os.[name|version|arch]
, and also a UTC timestamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now looks like:
key: +- bean, += managed, +~ unmanaged, +? auto, +: iterable, +] array, +@ map, +> undefined
JVM: OpenJDK Runtime Environment 22+36-2370; OS: Linux amd64 6.5.0-35-generic; Jetty: 12.0.10-SNAPSHOT; CPUs: 20; mem(free/total/max): 4,022/4,096/6,144 MB
UTC: 2024-05-27T13:17:06.456Z; Europe/Rome: 2024-05-27T15:17:06.456 +0200
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/component/Dumpable.java
Outdated
Show resolved
Hide resolved
System.getProperty("java.runtime.name"), | ||
System.getProperty("java.runtime.version"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vendor is missing, and it's important (say IBM).
I would use: java.vendor
java.vm.name
java.vm.version
.
For example, IBM's does not have any java.runtime.*
properties (at least according to their docs).
Use MiB
instead of MB
(powers of 1024 instead of 1000).
I would just print the UTC time, not the local one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having UTC and local time... it is OK for you who only lives an hour or 2 off UTC, but for those of us that struggle with bigger differences, it can be nice to have them both listed :)
Having said that, my laptop still thinks it is in Italy??!?!?
DateTimeFormatter UTC_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneOffset.UTC); | ||
DateTimeFormatter LOCAL_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS Z").withZone(ZoneId.of(System.getProperty("user.timezone"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are now public constants that are just an implementation detail.
I would just allocate them on-the-fly for the formatting, if necessary.
Actually, I think there are predefined constants in DateTimeFormatter
, but I would not even do that.
Just calling Instant.toString()
formats it in UTC following the standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this output:
key: +- bean, += managed, +~ unmanaged, +? auto, +: iterable, +] array, +@ map, +> undefined
JVM: Oracle Corporation OpenJDK 64-Bit Server VM 22+36-2370; OS: Linux amd64 6.5.0-35-generic; Jetty: 12.0.10-SNAPSHOT; CPUs: 20; mem(free/total/max): 4,022/4,096/6,144 MiB
UTC: 2024-05-27T21:59:02.015802402Z; Europe/Rome: 2024-05-27T23:59:02.015802402+02:00
Fix #9177 dump info from Runtime, Jetty.VERSION and
System.getProperties
:Sample output is: