-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): support recording slow query log #2327
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2327 +/- ##
============================================
+ Coverage 63.85% 66.28% +2.43%
- Complexity 684 981 +297
============================================
Files 505 507 +2
Lines 41902 42084 +182
Branches 5817 5832 +15
============================================
+ Hits 26756 27897 +1141
+ Misses 12455 11475 -980
- Partials 2691 2712 +21
... and 111 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rebase latest master code
hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
Outdated
Show resolved
Hide resolved
# Conflicts: # hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holding the timeThreshold in a private variable and changing its type to long would be better, reducing the cost of unboxing and hash searching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks , but i dont know “Holding the timeThreshold in a private variable ” means what? thanks again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
we cant get timeThreshold as private var from configProvider, because configProvider managed by @context; it will case NPE.
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Could also add some basic introduction for the record in doc |
* chore(api): code style for cr --------- Co-authored-by: imbajin <[email protected]>
* chore(api): code style for cr --------- Co-authored-by: imbajin <[email protected]>
Purpose of the PR
subtask of #2325
Main Changes
Verifying these changes
we can run test , and we can see:
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO