zhedoubushishi commented on a change in pull request #2833:
URL: https://github.com/apache/hudi/pull/2833#discussion_r642903715



##########
File path: 
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieMetricsPrometheusConfig.java
##########
@@ -77,25 +99,13 @@ public Builder fromProperties(Properties props) {
 
     public HoodieMetricsPrometheusConfig build() {
       HoodieMetricsPrometheusConfig config = new 
HoodieMetricsPrometheusConfig(props);
-      setDefaultOnCondition(props, !props.containsKey(PROMETHEUS_PORT), 
PROMETHEUS_PORT,
-              String.valueOf(DEFAULT_PROMETHEUS_PORT));
-      setDefaultOnCondition(props, !props.containsKey(PUSHGATEWAY_HOST),
-              PUSHGATEWAY_HOST,
-              DEFAULT_PUSHGATEWAY_HOST);
-      setDefaultOnCondition(props, !props.containsKey(PUSHGATEWAY_PORT),
-              PUSHGATEWAY_PORT,
-              String.valueOf(DEFAULT_PUSHGATEWAY_PORT));
-      setDefaultOnCondition(props, 
!props.containsKey(PUSHGATEWAY_REPORT_PERIOD_SECONDS),
-              PUSHGATEWAY_REPORT_PERIOD_SECONDS,
-              String.valueOf(DEFAULT_PUSHGATEWAY_REPORT_PERIOD_SECONDS));
-      setDefaultOnCondition(props, 
!props.containsKey(PUSHGATEWAY_DELETE_ON_SHUTDOWN),
-              PUSHGATEWAY_DELETE_ON_SHUTDOWN,
-              String.valueOf(DEFAULT_PUSHGATEWAY_DELETE_ON_SHUTDOWN));
-      setDefaultOnCondition(props, !props.containsKey(PUSHGATEWAY_JOB_NAME),
-              PUSHGATEWAY_JOB_NAME, DEFAULT_PUSHGATEWAY_JOB_NAME);
-      setDefaultOnCondition(props, 
!props.containsKey(PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX),
-              PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX,
-              String.valueOf(DEFAULT_PUSHGATEWAY_RANDOM_JOB_NAME_SUFFIX));
+      setDefaultValue(props, PROMETHEUS_PORT);

Review comment:
       Thanks for pointing this out. I created a method 
```ConfigOption#registerConfig``` which could automatically register the config 
when initializing it.




-- 
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]


Reply via email to