HDDS-11599. Add time zone information in ReportSubcommand#outputHeader
What changes were proposed in this pull request?
Add time zone information in ReportSubcommand#outputHeader
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11599
How was this patch tested?
manual tests
Hi @weimingdiit. Could you share the output after this change?
Sure,my current time with time zone is 2024-10-26T15:09:49
Before modification:
Container Summary Report generated at 2024-10-26T07:09:49Z
==========================================================
After modification:
Container Summary Report generated at 2024-10-26T15:09:49
==========================================================
Sure,my current time with time zone is 2024-10-26T15:09:49
Before modification:
Container Summary Report generated at 2024-10-26T07:09:49Z ==========================================================After modification:
Container Summary Report generated at 2024-10-26T15:09:49 ==========================================================
It seems to me the change actually removes timezone information from the output. 07:09:49Z may be inconvenient, but it's clear that time is UTC. 15:09:49 could be different time in various timezones.
So we may need to consider including timezone in the output.
Also:
Is output of other Ozone commands consistent in how they display time? (date/time format, display timezone (UTC vs. local))
- If so, is this change making it consistent with other commands?
- If not:
- What kind of different output formats do we have?
- Is this the only command that needs to be changed?
- Is the new format (local time + time zone) the desired output format we should standardise on?
Is output of other Ozone commands consistent in how they display time? (date/time format, display timezone (UTC vs. local))
- If so, is this change making it consistent with other commands?
@adoroszlai Thanks for your comment. yes, I checked other ozone commands, and my output is consistent with the format in the ContainerBalancerStatusSubcommand command. The code in ContainerBalancerStatusSubcommand is as follows,the local date and time without the time zone is output in ContainerBalancerStatusSubcommand
if (isRunning) {
LocalDateTime dateTime =
LocalDateTime.ofInstant(Instant.ofEpochSecond(balancerStatusInfo.getStartedAt()), ZoneId.systemDefault());
System.out.println("ContainerBalancer is Running.");
if (verbose) {
System.out.printf("Started at: %s %s%n%n", dateTime.toLocalDate(), dateTime.toLocalTime());
System.out.println(getConfigurationPrettyString(balancerStatusInfo.getConfiguration()));
......
}
}
@weimingdiit ContainerBalancerStatusSubcommand may be the outlier in this case, and I'm not sure we should follow the same pattern. The only other usage of LocalDateTime is in code related to certificates.
Can you please start a discussion on the dev mailing list to collect more opinions?
/pending discussion on dev mailing list
Thank you very much for the patch. I am closing this PR temporarily as there was no activity recently and it is waiting for response from its author.
It doesn't mean that this PR is not important or ignored: feel free to reopen the PR at any time.
It only means that attention of committers is not required. We prefer to keep the review queue clean. This ensures PRs in need of review are more visible, which results in faster feedback for all PRs.
If you need ANY help to finish this PR, please contact the community on the mailing list or the slack channel."