Skip to content

Commit ffa7973

Browse files
committed
address review comments
- Fix Javadoc grammar: "record" -> "records" - Merge getOrCreateSuccessMetric/getOrCreateErrorMetric into single getOrCreateMetric
1 parent 9837087 commit ffa7973

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

services/venice-server/src/main/java/com/linkedin/venice/stats/BackupVersionOptimizationServiceStats.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
/**
19-
* {@code BackupVersionOptimizationServiceStats} record the statistics for the database optimization done by the
19+
* {@code BackupVersionOptimizationServiceStats} records the statistics for the database optimization done by the
2020
* {@link BackupVersionOptimizationService} including both successes and failures.
2121
*
2222
* <p>OTel uses a single COUNTER with STORE_NAME + OPERATION_OUTCOME dimensions. Tehuti uses
@@ -53,23 +53,20 @@ public BackupVersionOptimizationServiceStats(MetricsRepository metricsRepository
5353
}
5454

5555
public void recordBackupVersionDatabaseOptimization(String storeName) {
56-
getOrCreateSuccessMetric(storeName).record(1, VeniceOperationOutcome.SUCCESS);
56+
getOrCreateMetric(successPerStore, storeName, TehutiMetricName.BACKUP_VERSION_DATABASE_OPTIMIZATION)
57+
.record(1, VeniceOperationOutcome.SUCCESS);
5758
}
5859

5960
public void recordBackupVersionDatabaseOptimizationError(String storeName) {
60-
getOrCreateErrorMetric(storeName).record(1, VeniceOperationOutcome.FAIL);
61+
getOrCreateMetric(errorPerStore, storeName, TehutiMetricName.BACKUP_VERSION_DATA_OPTIMIZATION_ERROR)
62+
.record(1, VeniceOperationOutcome.FAIL);
6163
}
6264

63-
private MetricEntityStateOneEnum<VeniceOperationOutcome> getOrCreateSuccessMetric(String storeName) {
64-
return successPerStore.computeIfAbsent(
65-
storeName,
66-
k -> createPerStoreMetric(k, TehutiMetricName.BACKUP_VERSION_DATABASE_OPTIMIZATION));
67-
}
68-
69-
private MetricEntityStateOneEnum<VeniceOperationOutcome> getOrCreateErrorMetric(String storeName) {
70-
return errorPerStore.computeIfAbsent(
71-
storeName,
72-
k -> createPerStoreMetric(k, TehutiMetricName.BACKUP_VERSION_DATA_OPTIMIZATION_ERROR));
65+
private MetricEntityStateOneEnum<VeniceOperationOutcome> getOrCreateMetric(
66+
Map<String, MetricEntityStateOneEnum<VeniceOperationOutcome>> perStoreMap,
67+
String storeName,
68+
TehutiMetricName tehutiName) {
69+
return perStoreMap.computeIfAbsent(storeName, k -> createPerStoreMetric(k, tehutiName));
7370
}
7471

7572
private MetricEntityStateOneEnum<VeniceOperationOutcome> createPerStoreMetric(

0 commit comments

Comments
 (0)