RFR: 7506: Incorrect numeric formatting of PID by JMC [v2]
Marcus Hirt
hirt at openjdk.org
Mon Mar 25 15:30:29 UTC 2024
On Mon, 25 Mar 2024 05:05:39 GMT, Suchita Chaturvedi <schaturvedi at openjdk.org> wrote:
>> This PR is to fix the formatting issue of the JVM PID on JVM information screen. JVM PID attribute is received as NUMBER from JFR and hence the JMC application is treating is as number. When the number is smaller , the PID is displayed using commas and when the number is larger, its converted to exponential format. This is a long pending bug in product.
>>
>> As part of this PR we have introduced a new aggregator JVM_PID_ID which will contain the value of Identifier in plain text format instead of number format. This new aggregator is displayed on JVM Information page so that formatting is not applied as per NUMBER formatting rules.
>>
>> JVM PID before the change:
>> <img width="359" alt="image" src="https://github.com/openjdk/jmc/assets/11155712/2e2a238c-8160-4bd1-8285-fb2a7a4fb85c">
>>
>> JVM PID after the change:
>> <img width="355" alt="image" src="https://github.com/openjdk/jmc/assets/11155712/92668a9d-6053-4fa1-bcd0-7face596bc15">
>>
>> The issue is more prominent when the identifier value is converted to exponential.
>
> Suchita Chaturvedi has updated the pull request incrementally with one additional commit since the last revision:
>
> Fixed the pid formatting issue on Event Browser and Properties section also
Changes requested by hirt (Lead).
core/org.openjdk.jmc.common/src/main/java/org/openjdk/jmc/common/item/Aggregators.java line 1051:
> 1049: }
> 1050:
> 1051: public static <T> IAggregator<Number, ?> getIdentifier(String typeId, IAttribute<T> attribute) {
Do we need a special aggregator for this? We should override the value type for the PID field so that the correct value type is returned.
core/org.openjdk.jmc.common/src/main/java/org/openjdk/jmc/common/item/Aggregators.java line 1057:
> 1055: @Override
> 1056: public IType<? super Number> getValueType() {
> 1057: return UnitLookup.RAW_NUMBER;
If we're going this route, I guess this should be RAW_LONG. It does make process identifiers prone to any changes to default formatting of longs though. Another solution would be to introduce a ProcessIdentifier content type, and handle the formatting of that content type more explicitly. This is a smaller change though, and I think acceptable for now.
-------------
PR Review: https://git.openjdk.org/jmc/pull/557#pullrequestreview-1958055833
PR Review Comment: https://git.openjdk.org/jmc/pull/557#discussion_r1537787635
PR Review Comment: https://git.openjdk.org/jmc/pull/557#discussion_r1537779076
More information about the jmc-dev
mailing list