lynnbond commented on code in PR #2327:
URL:
https://github.com/apache/incubator-hugegraph/pull/2327#discussion_r1369597849
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java:
##########
@@ -62,13 +79,24 @@ public void filter(ContainerRequestContext requestContext,
ContainerResponseCont
// get responseTime
Object requestTime = requestContext.getProperty(REQUEST_TIME);
- if(requestTime!=null){
+ if(requestTime != null){
long now = System.currentTimeMillis();
- long responseTime = (now - (long)requestTime);
+ long start = (Long) requestTime;
+ long responseTime = now - start;
MetricsUtil.registerHistogram(
join(metricsName,
METRICS_PATH_RESPONSE_TIME_HISTOGRAM))
.update(responseTime);
+
+ HugeConfig config = configProvider.get();
+ Long timeThreshold =
config.get(ServerOptions.SLOW_QUERY_LOG_TIME_THRESHOLD);
Review Comment:
Just like this:
```
public class AccessLogFilter implements ContainerResponseFilter {
private long timeThreshold
=configProvider.get().get(ServerOptions.SLOW_QUERY_LOG_TIME_THRESHOLD);
.....
}
```
Of course, you need to check for null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]