Skip to content

Commit

Permalink
add NoopQueryMetricCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Sep 15, 2023
1 parent 1f74c8d commit ee1e1fa
Showing 1 changed file with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Throwables;
import org.apache.druid.jackson.DefaultObjectMapper;
import org.apache.druid.server.QueryResource.QueryMetricCounter;
import org.apache.druid.server.QueryResultPusher.ResultsWriter;
import org.apache.druid.server.QueryResultPusher.Writer;
import org.apache.druid.server.mocks.MockHttpServletRequest;
Expand All @@ -36,7 +37,6 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.easymock.EasyMock.mock;
import static org.junit.Assert.assertTrue;

public class QueryResultPusherTest
Expand All @@ -58,7 +58,7 @@ public void testResultPusherRetainsNestedExceptionBacktraces()
ObjectMapper jsonMapper = new DefaultObjectMapper();
ResponseContextConfig responseContextConfig = ResponseContextConfig.newConfig(true);
DruidNode selfNode = DRUID_NODE;
QueryResource.QueryMetricCounter counter = mock(QueryResource.QueryMetricCounter.class);
QueryResource.QueryMetricCounter counter = new NoopQueryMetricCounter();
String queryId = "someQuery";
MediaType contentType = MediaType.APPLICATION_JSON_TYPE;
Map<String, String> extraHeaders = new HashMap<String, String>();
Expand Down Expand Up @@ -133,4 +133,29 @@ public ResultsWriter start()

assertTrue("recordFailure(e) should have been invoked!", recordFailureInvoked.get());
}

static class NoopQueryMetricCounter implements QueryMetricCounter
{

@Override
public void incrementSuccess()
{
}

@Override
public void incrementFailed()
{
}

@Override
public void incrementInterrupted()
{
}

@Override
public void incrementTimedOut()
{
}

}
}

0 comments on commit ee1e1fa

Please sign in to comment.