Skip to content
Permalink
Browse files
Emit vectorized metric dimension by default (#12464)
  • Loading branch information
rohangarg committed Apr 21, 2022
1 parent 177e185 commit 4c6ba73823bc0561dad1ea9c0088238922438f23
Showing 2 changed files with 20 additions and 1 deletion.
@@ -201,7 +201,7 @@ public void identity(String identity)
@Override
public void vectorized(final boolean vectorized)
{
// Emit nothing by default.
setDimension("vectorized", vectorized);
}

@Override
@@ -156,4 +156,23 @@ public static void testQueryMetricsDefaultMetricNamesAndUnits(
Assert.assertEquals("query/node/bytes", actualEvent.get("metric"));
Assert.assertEquals(10L, actualEvent.get("value"));
}

@Test
public void testVectorizedDimensionInMetrics()
{
CachingEmitter cachingEmitter = new CachingEmitter();
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>();
queryMetrics.vectorized(true);
queryMetrics.reportSegmentTime(0).emit(serviceEmitter);
Map<String, Object> actualEvent = cachingEmitter.getLastEmittedEvent().toMap();
Assert.assertEquals(7, actualEvent.size());
Assert.assertTrue(actualEvent.containsKey("feed"));
Assert.assertTrue(actualEvent.containsKey("timestamp"));
Assert.assertEquals("", actualEvent.get("host"));
Assert.assertEquals("", actualEvent.get("service"));
Assert.assertEquals("query/segment/time", actualEvent.get("metric"));
Assert.assertEquals(0L, actualEvent.get("value"));
Assert.assertEquals(true, actualEvent.get("vectorized"));
}
}

0 comments on commit 4c6ba73

Please sign in to comment.