1
0

[HUDI-3373] Add zero value metrics for empty data source and PROMETHEUS_PUSHGATEWAY reporter (#4760)

This commit is contained in:
Vinish Reddy
2022-02-08 01:47:46 +05:30
committed by GitHub
parent 3bd8fc1c3e
commit 8ab6f17149
2 changed files with 26 additions and 0 deletions

View File

@@ -130,6 +130,26 @@ public class HoodieMetrics {
return indexTimer == null ? null : indexTimer.time();
}
public void updateMetricsForEmptyData(String actionType) {
if (!config.isMetricsOn() || !config.getMetricsReporterType().equals(MetricsReporterType.PROMETHEUS_PUSHGATEWAY)) {
// No-op if metrics are not of type PROMETHEUS_PUSHGATEWAY.
return;
}
Metrics.registerGauge(getMetricsName(actionType, "totalPartitionsWritten"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalFilesInsert"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalFilesUpdate"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalRecordsWritten"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalUpdateRecordsWritten"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalInsertRecordsWritten"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalBytesWritten"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalScanTime"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalCreateTime"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalUpsertTime"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalCompactedRecordsUpdated"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalLogFilesCompacted"), 0);
Metrics.registerGauge(getMetricsName(actionType, "totalLogFilesSize"), 0);
}
public void updateCommitMetrics(long commitEpochTimeInMs, long durationInMs, HoodieCommitMetadata metadata,
String actionType) {
updateCommitTimingMetrics(commitEpochTimeInMs, durationInMs, metadata, actionType);