From 70b9602487c21ac694a232508520aaeb6d8f08c5 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 14 Nov 2024 13:21:09 +0530 Subject: [PATCH 1/2] Enhance metric --- .../repository/graphdb/janus/AtlasElasticsearchQuery.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java index b8a210ded6..081f38ce29 100644 --- a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java +++ b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java @@ -176,7 +176,6 @@ private Map 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 { @@ -209,7 +208,7 @@ private DirectIndexQueryResult performAsyncDirectIndexQuery(SearchParams searchP // 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("timeout exceeded for query {}:", searchParams.getQuery()); - RequestContext.get().endMetricRecord(metricSearchTimeout); + RequestContext.get().endMetricRecord(RequestContext.get().startMetricRecord("asyncDirectIndexQueryTimeout")); throw new AtlasBaseException(AtlasErrorCode.INDEX_SEARCH_FAILED_DUE_TO_TIMEOUT, KeepAliveTime); } result = getResultFromResponse(response.getFullResponse(), true); From b0e885b0c5f0d2bf4c27b40850d4fe7770f515e8 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 14 Nov 2024 13:24:14 +0530 Subject: [PATCH 2/2] fix metric name --- .../atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java index 081f38ce29..dc46861b12 100644 --- a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java +++ b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasElasticsearchQuery.java @@ -208,7 +208,7 @@ private DirectIndexQueryResult performAsyncDirectIndexQuery(SearchParams searchP // 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("timeout exceeded for query {}:", searchParams.getQuery()); - RequestContext.get().endMetricRecord(RequestContext.get().startMetricRecord("asyncDirectIndexQueryTimeout")); + RequestContext.get().endMetricRecord(RequestContext.get().startMetricRecord("elasticQueryTimeout")); throw new AtlasBaseException(AtlasErrorCode.INDEX_SEARCH_FAILED_DUE_TO_TIMEOUT, KeepAliveTime); } result = getResultFromResponse(response.getFullResponse(), true);