Skip to content

Commit 6797aeb

Browse files
author
Whitney Deng
committed
add STORE_NOMINATED_FOR_SCHEDULED_COMPACTION to LogCompactionStats
1 parent e3d1704 commit 6797aeb

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

services/venice-controller/src/main/java/com/linkedin/venice/controller/stats/LogCompactionStats.java

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class LogCompactionStats extends AbstractVeniceStats {
2929

3030
/** metrics */
3131
private final MetricEntityStateGeneric repushStoreCallCountMetric;
32+
private final MetricEntityStateGeneric storeNominatedForScheduledCompactionMetric;
3233

3334
public LogCompactionStats(MetricsRepository metricsRepository, String clusterName) {
3435
super(metricsRepository, "LogCompactionStats");
@@ -62,24 +63,52 @@ public LogCompactionStats(MetricsRepository metricsRepository, String clusterNam
6263
ControllerTehutiMetricNameEnum.REPUSH_STORE_ENDPOINT_CALL_COUNT,
6364
Collections.singletonList(new Count()),
6465
baseDimensionsMap);
66+
67+
storeNominatedForScheduledCompactionMetric = MetricEntityStateGeneric.create(
68+
ControllerMetricEntity.STORE_NOMINATED_FOR_SCHEDULED_COMPACTION.getMetricEntity(),
69+
otelRepository,
70+
this::registerSensor,
71+
ControllerTehutiMetricNameEnum.STORE_NOMINATED_FOR_SCHEDULED_COMPACTION,
72+
Collections.singletonList(new Count()),
73+
baseDimensionsMap);
6574
}
6675

6776
public void recordRepushStoreCall(
6877
String storeName,
6978
RepushStoreTriggerSource triggerSource,
7079
VeniceResponseStatusCategory responseStatusCategory) {
71-
repushStoreCallCountMetric.record(1, new HashMap<VeniceMetricsDimensions, String>(baseDimensionsMap) {
80+
storeNominatedForScheduledCompactionMetric
81+
.record(1, new HashMap<VeniceMetricsDimensions, String>(baseDimensionsMap) {
82+
{
83+
put(VeniceMetricsDimensions.VENICE_STORE_NAME, storeName);
84+
put(VeniceMetricsDimensions.REPUSH_STORE_TRIGGER_SOURCE, triggerSource.getDimensionValue());
85+
put(
86+
VeniceMetricsDimensions.VENICE_RESPONSE_STATUS_CODE_CATEGORY,
87+
responseStatusCategory.getDimensionValue());
88+
}
89+
});
90+
}
91+
92+
public void recordStoreNominatedForScheduledCompaction(String storeName) {
93+
storeNominatedForScheduledCompactionMetric
94+
.record(1, new HashMap<VeniceMetricsDimensions, String>(baseDimensionsMap) {
95+
{
96+
put(VeniceMetricsDimensions.VENICE_STORE_NAME, storeName);
97+
}
98+
});
99+
}
100+
101+
public void recordStoreRepushedSuccessfullyForScheduledCompaction(String storeName) {
102+
repushStoreCallCountMetric.record(0, new HashMap<VeniceMetricsDimensions, String>(baseDimensionsMap) {
72103
{
73104
put(VeniceMetricsDimensions.VENICE_STORE_NAME, storeName);
74-
put(VeniceMetricsDimensions.REPUSH_STORE_TRIGGER_SOURCE, triggerSource.getDimensionValue());
75-
put(VeniceMetricsDimensions.VENICE_RESPONSE_STATUS_CODE_CATEGORY, responseStatusCategory.getDimensionValue());
76105
}
77106
});
78107
}
79108

80109
enum ControllerTehutiMetricNameEnum implements TehutiMetricNameEnum {
81110
/** for {@link ControllerMetricEntity#REPUSH_STORE_ENDPOINT_CALL_COUNT} */
82-
REPUSH_STORE_ENDPOINT_CALL_COUNT;
111+
REPUSH_STORE_ENDPOINT_CALL_COUNT, STORE_NOMINATED_FOR_SCHEDULED_COMPACTION;
83112

84113
private final String metricName;
85114

0 commit comments

Comments
 (0)