mirror of https://github.com/apache/druid.git
Fix segment/deleted/count metric not being emitted (#14433)
* Fix segment/deleted/count metric * Fix segment/deleted/count metric * Fix segment/deleted/count metric
This commit is contained in:
parent
4935f2470a
commit
5d76d0ea74
|
@ -283,7 +283,7 @@ These metrics are for the Druid Coordinator and are reset each time the Coordina
|
|||
|`segment/moved/count`|Number of segments moved in the cluster.|`tier`|Varies|
|
||||
|`segment/unmoved/count`|Number of segments which were chosen for balancing but were found to be already optimally placed.|`tier`|Varies|
|
||||
|`segment/dropped/count`|Number of segments chosen to be dropped from the cluster due to being over-replicated.|`tier`|Varies|
|
||||
|`segment/deleted/count`|Number of segments marked as unused due to drop rules.|`tier`|Varies|
|
||||
|`segment/deleted/count`|Number of segments marked as unused due to drop rules.| |Varies|
|
||||
|`segment/unneeded/count`|Number of segments dropped due to being marked as unused.|`tier`|Varies|
|
||||
|`segment/cost/raw`|Used in cost balancing. The raw cost of hosting segments.|`tier`|Varies|
|
||||
|`segment/cost/normalization`|Used in cost balancing. The normalization of hosting segments.|`tier`|Varies|
|
||||
|
|
|
@ -190,7 +190,13 @@ public class EmitClusterStatsAndMetrics implements CoordinatorDuty
|
|||
emitTieredStats(emitter, "segment/moved/count", stats, "movedCount");
|
||||
emitTieredStats(emitter, "segment/unmoved/count", stats, "unmovedCount");
|
||||
|
||||
emitTieredStats(emitter, "segment/deleted/count", stats, "deletedCount");
|
||||
emitter.emit(
|
||||
new ServiceMetricEvent.Builder()
|
||||
.build(
|
||||
"segment/deleted/count",
|
||||
stats.getGlobalStat("deletedCount")
|
||||
)
|
||||
);
|
||||
|
||||
stats.forEachTieredStat(
|
||||
"normalizedInitialCostTimesOneThousand",
|
||||
|
|
|
@ -71,6 +71,7 @@ public class EmitClusterStatsAndMetricsTest
|
|||
List<ServiceEventBuilder> emittedEvents = argumentCaptor.getAllValues();
|
||||
boolean foundCompactMetric = false;
|
||||
boolean foundHistoricalDutyMetric = false;
|
||||
boolean foundSegmentDeletedCount = false;
|
||||
for (ServiceEventBuilder eventBuilder : emittedEvents) {
|
||||
ServiceMetricEvent serviceMetricEvent = ((ServiceMetricEvent) eventBuilder.build("x", "x"));
|
||||
String metric = serviceMetricEvent.getMetric();
|
||||
|
@ -78,6 +79,9 @@ public class EmitClusterStatsAndMetricsTest
|
|||
foundHistoricalDutyMetric = true;
|
||||
} else if ("compact/task/count".equals(metric)) {
|
||||
foundCompactMetric = true;
|
||||
} else if ("segment/deleted/count".equals(metric)) {
|
||||
foundSegmentDeletedCount = true;
|
||||
continue;
|
||||
}
|
||||
String dutyGroup = (String) serviceMetricEvent.getUserDims().get("dutyGroup");
|
||||
Assert.assertNotNull(dutyGroup);
|
||||
|
@ -85,6 +89,7 @@ public class EmitClusterStatsAndMetricsTest
|
|||
}
|
||||
Assert.assertTrue(foundHistoricalDutyMetric);
|
||||
Assert.assertFalse(foundCompactMetric);
|
||||
Assert.assertTrue(foundSegmentDeletedCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue