yihua commented on code in PR #17466:
URL: https://github.com/apache/hudi/pull/17466#discussion_r2583601406


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -175,6 +176,15 @@ public BaseHoodieWriteClient(HoodieEngineContext context,
     super(context, writeConfig, timelineService);
     this.index = createIndex(writeConfig);
     this.upgradeDowngradeHelper = upgradeDowngradeHelper;
+    if (config.isMetricsOn()) {
+      // report userName and hudi version
+      final String version = HoodieVersion.get();
+      metrics.getMetrics().registerGauge(metrics.getMetricsName("userName", 
System.getProperty("user.name")), 1);
+      metrics.getMetrics().registerGauge(metrics.getMetricsName("version", 
StringUtils.isNullOrEmpty(version) ? "0.14.x" : version), 1);
+      metrics.getMetrics().registerGauge("version.major", 
HoodieVersion.majorAsInt());
+      metrics.getMetrics().registerGauge("version.minor", 
HoodieVersion.minorAsInt());
+      metrics.getMetrics().registerGauge("version.patch", 
HoodieVersion.patchAsInt());

Review Comment:
   Are these still needed if the full `version` is published?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -175,6 +176,15 @@ public BaseHoodieWriteClient(HoodieEngineContext context,
     super(context, writeConfig, timelineService);
     this.index = createIndex(writeConfig);
     this.upgradeDowngradeHelper = upgradeDowngradeHelper;
+    if (config.isMetricsOn()) {
+      // report userName and hudi version
+      final String version = HoodieVersion.get();
+      metrics.getMetrics().registerGauge(metrics.getMetricsName("userName", 
System.getProperty("user.name")), 1);
+      metrics.getMetrics().registerGauge(metrics.getMetricsName("version", 
StringUtils.isNullOrEmpty(version) ? "0.14.x" : version), 1);
+      metrics.getMetrics().registerGauge("version.major", 
HoodieVersion.majorAsInt());
+      metrics.getMetrics().registerGauge("version.minor", 
HoodieVersion.minorAsInt());
+      metrics.getMetrics().registerGauge("version.patch", 
HoodieVersion.patchAsInt());
+    }

Review Comment:
   Could the logic be put into `HoodieMetrics` class, similar to 
`HoodieMetrics#emitIndexTypeMetrics`?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to