From 6d3be267fe8799a25629e01a050c356895aeb11c Mon Sep 17 00:00:00 2001 From: 1289220708 <1289220708@qq.com> Date: Mon, 23 Oct 2023 23:20:46 +0800 Subject: [PATCH] chore(api): code style for cr --- .../hugegraph/api/filter/AccessLogFilter.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java b/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java index 3f57f1a8e9..3b529cf0a3 100644 --- a/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java +++ b/hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java @@ -89,7 +89,7 @@ public void filter(ContainerRequestContext requestContext, ContainerResponseCont .update(responseTime); HugeConfig config = configProvider.get(); - Long timeThreshold = config.get(ServerOptions.SLOW_QUERY_LOG_TIME_THRESHOLD); + long timeThreshold = config.get(ServerOptions.SLOW_QUERY_LOG_TIME_THRESHOLD); // record slow query log if (timeThreshold > 0 && isSlowQueryLogWhiteAPI(requestContext) && responseTime > timeThreshold) { @@ -112,17 +112,11 @@ public static boolean isSlowQueryLogWhiteAPI(ContainerRequestContext context) { String path = context.getUriInfo().getPath(); String method = context.getRequest().getMethod(); - // GraphsAPI - if (path.startsWith(GRAPHS) && method.equals(HttpMethod.GET)) { - return true; - } - // CypherAPI - if (path.startsWith(GRAPHS) && path.endsWith(CYPHER)) { - return true; - } - // Job GremlinAPI - if (path.startsWith(GRAPHS) && path.endsWith(GREMLIN)) { - return true; + // GraphsAPI/CypherAPI/Job GremlinAPI + if (path.startsWith(GRAPHS)) { + if (method.equals(HttpMethod.GET) || path.endsWith(CYPHER) || path.endsWith(GREMLIN) ){ + return true; + } } // Raw GremlinAPI return path.startsWith(GREMLIN);