Skip to content
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

fix(api): refactor/downgrade record logic for slow log #2347

Merged
merged 5 commits into from
Nov 13, 2023
Merged

Conversation

imbajin
Copy link
Member

@imbajin imbajin commented Nov 10, 2023

Purpose of the PR

add some TODOs & assign @SunnyBoy-WYH to address it

Main Changes

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • xxx

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects (slow log logic)

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

@imbajin imbajin added this to the 1.2.0 milestone Nov 10, 2023
Comment on lines 44 to 53
@Override
public String toString() {
return "SlowQueryLog{executeTime=" + executeTime +
", startTime=" + startTime +
", rawQuery='" + rawQuery + '\'' +
", method='" + method + '\'' +
", threshold=" + threshold +
", path='" + path + '\'' +
'}';
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to use this class now, just reserve it

Copy link

codecov bot commented Nov 10, 2023

Codecov Report

Merging #2347 (c0d56b1) into master (a7ad7ea) will increase coverage by 5.46%.
The diff coverage is 68.00%.

@@             Coverage Diff              @@
##             master    #2347      +/-   ##
============================================
+ Coverage     60.44%   65.90%   +5.46%     
- Complexity      678      981     +303     
============================================
  Files           507      507              
  Lines         42083    42073      -10     
  Branches       5832     5831       -1     
============================================
+ Hits          25438    27730    +2292     
+ Misses        14069    11642    -2427     
- Partials       2576     2701     +125     
Files Coverage Δ
...va/org/apache/hugegraph/api/filter/PathFilter.java 100.00% <ø> (ø)
...g/apache/hugegraph/api/filter/AccessLogFilter.java 93.54% <89.47%> (-3.33%) ⬇️
...ava/org/apache/hugegraph/metrics/SlowQueryLog.java 0.00% <0.00%> (-100.00%) ⬇️

... and 90 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

method, timeThreshold, path);
LOG.info("Slow query: {}", JsonUtil.toJson(log));
// Record slow query if meet needs, watch out the perf
if (timeThreshold > 0 && timeThreshold < executeTime &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer executeTime > timeThreshold

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to just update the small change in this PR so that we don’t have to keep track of it.
background: in order to make it easier to read/understand, prefer to determine whether the executeTime exceeds a threshold.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to just update the small change in this PR so that we don’t have to keep track of it. background: in order to make it easier to read/understand, prefer to determine whether the executeTime exceeds a threshold.

Done, already divide it, @SunnyBoy-WYH could address the background in next PR

@@ -19,25 +19,36 @@

public class SlowQueryLog {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be removed?

depends on whether to use it for subsequent optimization(could keep it now)

zyxxoo
zyxxoo previously approved these changes Nov 12, 2023
method, timeThreshold, path);
LOG.info("Slow query: {}", JsonUtil.toJson(log));
// Record slow query if meet needs, watch out the perf
if (timeThreshold > 0 && timeThreshold < executeTime &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to just update the small change in this PR so that we don’t have to keep track of it.
background: in order to make it easier to read/understand, prefer to determine whether the executeTime exceeds a threshold.

@imbajin imbajin mentioned this pull request Nov 13, 2023
11 tasks
@imbajin imbajin merged commit a6e1f23 into master Nov 13, 2023
18 of 21 checks passed
@imbajin imbajin deleted the fix-slowlog branch November 13, 2023 10:03
@SunnyBoy-WYH
Copy link
Contributor

SunnyBoy-WYH commented Nov 13, 2023

@javeme hi,like this pr's todo , we need record the request's query language, do you know how can we get the requestbody? from my option, i try some methods but only this work: [get the post query and set it again] ,but it seems caused the bug.

ref:https://stackoverflow.com/questions/14560276/how-to-use-jersey-interceptors-to-get-request-body

when use loader on C/S model ,it cause GZIP format error.

VGalaxies pushed a commit to VGalaxies/incubator-hugegraph that referenced this pull request Jan 12, 2024
* fix(api): refactor/downgrade record logic for slow log

add some TODOs & assign @SunnyBoy-WYH to address it

* fix typo

* enhance the perf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants