Skip to content

Commit

Permalink
capture number of queries that timedout
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshi0301 committed Nov 14, 2024
1 parent ce06a59 commit eac1e55
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ private Map<String, Object> runQueryWithLowLevelClient(String query) throws Atla

private DirectIndexQueryResult performAsyncDirectIndexQuery(SearchParams searchParams) throws AtlasBaseException, IOException {
AtlasPerfMetrics.MetricRecorder metric = RequestContext.get().startMetricRecord("performAsyncDirectIndexQuery");
AtlasPerfMetrics.MetricRecorder metricSearchTimeout = RequestContext.get().startMetricRecord("asyncDirectIndexQueryTimeout");
DirectIndexQueryResult result = null;
boolean contextIdExists = StringUtils.isNotEmpty(searchParams.getSearchContextId()) && searchParams.getSearchContextSequenceNo() != null;
try {
Expand Down Expand Up @@ -207,7 +208,8 @@ private DirectIndexQueryResult performAsyncDirectIndexQuery(SearchParams searchP
if (response == null) {
// Rather than null (if the response is null wil help returning @204 HTTP_NO_CONTENT to the user)
// return timeout exception to user
LOG.error("query timeout exceeded {}:", searchParams.getQuery());
LOG.error("timeout exceeded for query {}:", searchParams.getQuery());
RequestContext.get().endMetricRecord(metricSearchTimeout);
throw new AtlasBaseException(AtlasErrorCode.INDEX_SEARCH_FAILED_DUE_TO_TIMEOUT, KeepAliveTime);
}
result = getResultFromResponse(response.getFullResponse(), true);
Expand Down

0 comments on commit eac1e55

Please sign in to comment.