kfaraz commented on code in PR #14453:
URL: https://github.com/apache/druid/pull/14453#discussion_r1238505123
##########
sql/src/test/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCacheTest.java:
##########
@@ -1447,6 +1456,25 @@ public void testStaleDatasourceRefresh() throws
IOException, InterruptedExceptio
Assert.assertNull(schema.getDatasource("wat"));
}
+ @Test
+ public void testRefreshShouldEmitMetrics() throws InterruptedException
+ {
+ StubServiceEmitter emitter = new StubServiceEmitter("broker", "host");
+ buildSchemaMarkAndTableLatch(SEGMENT_CACHE_CONFIG_DEFAULT, emitter);
+
+ Map<String, Set<Object>> emittedEventsMap =
+ emitter.getEvents()
+ .stream()
+ .map(ServiceMetricEvent.class::cast)
+ .collect(Collectors.groupingBy(
+ ServiceMetricEvent::getMetric,
+ Collectors.mapping(sme ->
sme.getUserDims().get(DruidMetrics.DATASOURCE), Collectors.toSet())
+ ));
+ Assert.assertTrue(emittedEventsMap.containsKey("init/metadatacache/time"));
+
Assert.assertTrue(emittedEventsMap.get("segment/metadatacache/refresh/count").size()
> 0);
+
Assert.assertTrue(emittedEventsMap.get("segment/metadatacache/refresh/time").size()
> 0);
Review Comment:
```suggestion
emitter.verifyEmitted("init/metadatacache/time", 1);
emitter.verifyEmitted("segment/metadatacache/refresh/time",
ImmutableMap.of(DruidMetrics.DATASOURCE, 'yourds', 1));
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]