Ethanlm commented on a change in pull request #3318:
URL: https://github.com/apache/storm/pull/3318#discussion_r465126392
##########
File path:
storm-client/src/jvm/org/apache/storm/daemon/metrics/ClientMetricsUtils.java
##########
@@ -20,26 +20,31 @@
public class ClientMetricsUtils {
- public static TimeUnit getMetricsRateUnit(Map<String, Object> topoConf) {
- return getTimeUnitForCofig(topoConf,
Config.STORM_DAEMON_METRICS_REPORTER_PLUGIN_RATE_UNIT);
+ private static final String RATE_UNIT = "rate.unit";
+ private static final String DURATION_UNIT = "duration.unit";
+ // Use the specified IETF BCP 47 language tag string for a Locale
+ private static final String LOCALE = "locale";
+
+ public static TimeUnit getMetricsRateUnit(Map<String, Object>
reporterConf) {
+ return getTimeUnitForConfig(reporterConf, RATE_UNIT);
}
- public static TimeUnit getMetricsDurationUnit(Map<String, Object>
topoConf) {
- return getTimeUnitForCofig(topoConf,
Config.STORM_DAEMON_METRICS_REPORTER_PLUGIN_DURATION_UNIT);
+ public static TimeUnit getMetricsDurationUnit(Map<String, Object>
reporterConf) {
+ return getTimeUnitForConfig(reporterConf, DURATION_UNIT);
}
- public static Locale getMetricsReporterLocale(Map<String, Object>
topoConf) {
- String languageTag =
ObjectReader.getString(topoConf.get(Config.STORM_DAEMON_METRICS_REPORTER_PLUGIN_LOCALE),
null);
+ public static Locale getMetricsReporterLocale(Map<String, Object>
reporterConf) {
+ String languageTag = ObjectReader.getString(reporterConf.get(LOCALE),
null);
if (languageTag != null) {
return Locale.forLanguageTag(languageTag);
}
return null;
}
- private static TimeUnit getTimeUnitForCofig(Map<String, Object> topoConf,
String configName) {
- String rateUnitString =
ObjectReader.getString(topoConf.get(configName), null);
- if (rateUnitString != null) {
- return TimeUnit.valueOf(rateUnitString);
+ public static TimeUnit getTimeUnitForConfig(Map<String, Object> conf,
String configName) {
Review comment:
I can change it to reporterConf for clarity. I make it `conf` because
this is actually a general function so it can be any conf.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]