Skip to content

Commit

Permalink
Report broker query metrics (#43) (#225)
Browse files Browse the repository at this point in the history
* Report broker metrics (#43)

* Update tests for these metrics (#44)

* Use camelCase (#45)

* Use camelCase

* Remove comment
  • Loading branch information
pagrawal10 authored Sep 11, 2024
1 parent d85d1b1 commit 66f7801
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,71 +291,61 @@ public QueryMetrics<QueryType> reportNodeBytes(long byteCount)
@Override
public QueryMetrics<QueryType> reportBitmapConstructionTime(long timeNs)
{
// Don't emit by default.
return this;
return reportMillisTimeMetric("query/node/bitmapConstructionTime", timeNs);
}

@Override
public QueryMetrics<QueryType> reportSegmentRows(long numRows)
{
// Don't emit by default.
return this;
return reportMetric("query/segment/rows", numRows);
}

@Override
public QueryMetrics<QueryType> reportPreFilteredRows(long numRows)
{
// Don't emit by default.
return this;
return reportMetric("query/preFiltered/rows", numRows);
}

@Override
public QueryMetrics<QueryType> reportParallelMergeParallelism(int parallelism)
{
// Don't emit by default.
return this;
return reportMetric("query/parallelMerge/parallelism", parallelism);
}

@Override
public QueryMetrics<QueryType> reportParallelMergeInputSequences(long numSequences)
{
// Don't emit by default.
return this;
return reportMetric("query/parallelMerge/inputSequences", numSequences);
}

@Override
public QueryMetrics<QueryType> reportParallelMergeInputRows(long numRows)
{
// Don't emit by default.
return this;
return reportMetric("query/parallelMerge/inputRows", numRows);
}

@Override
public QueryMetrics<QueryType> reportParallelMergeOutputRows(long numRows)
{
// Don't emit by default.
return this;
return reportMetric("query/parallelMerge/outputRows", numRows);
}

@Override
public QueryMetrics<QueryType> reportParallelMergeTaskCount(long numTasks)
{
// Don't emit by default.
return this;
return reportMetric("query/parallelMerge/taskCount", numTasks);
}

@Override
public QueryMetrics<QueryType> reportParallelMergeTotalCpuTime(long timeNs)
{
// Don't emit by default.
return this;
return reportMillisTimeMetric("query/parallelMerge/totalCpuTime", timeNs);
}

@Override
public QueryMetrics<QueryType> reportQueriedSegmentCount(long segmentCount)
{
// Don't emit by default.
return this;
return reportMetric("query/queriedSegment/count", segmentCount);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ public static void testQueryMetricsDefaultMetricNamesAndUnits(
Assert.assertEquals("query/node/bytes", actualEvent.get("metric"));
Assert.assertEquals(10L, actualEvent.get("value"));

// Here we are testing that Queried Segment Count does not get emitted by the DefaultQueryMetrics and the last
// metric remains as query/node/bytes

queryMetrics.reportQueriedSegmentCount(25).emit(serviceEmitter);
actualEvent = cachingEmitter.getLastEmittedEvent().toMap();
Assert.assertEquals("query/node/bytes", actualEvent.get("metric"));
Assert.assertEquals(10L, actualEvent.get("value"));
Assert.assertEquals("query/queriedSegment/count", actualEvent.get("metric"));
Assert.assertEquals(25L, actualEvent.get("value"));
}

@Test
Expand Down

0 comments on commit 66f7801

Please sign in to comment.