-
Notifications
You must be signed in to change notification settings - Fork 522
chore(metrics): move queue time record to AsyncNetworkBandwidthLimiter #3010
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,7 +187,7 @@ public String getName() { | |
| } | ||
| } | ||
|
|
||
| private static class BucketItem implements Comparable<BucketItem> { | ||
| private class BucketItem implements Comparable<BucketItem> { | ||
| private final ThrottleStrategy strategy; | ||
| private final CompletableFuture<Void> cf; | ||
| private final long timestamp; | ||
|
|
@@ -212,6 +212,7 @@ public boolean complete(long completeSize, ExecutorService executor) { | |
| size -= completeSize; | ||
| if (size <= 0) { | ||
| executor.submit(() -> cf.complete(null)); | ||
| NetworkStats.getInstance().networkLimiterQueueTimeStats(type, strategy).record(System.nanoTime() - timestamp); | ||
|
||
| return true; | ||
| } | ||
| return false; | ||
|
|
||
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.
The
get()call beforecomputeIfAbsent()is redundant and can impact performance. ThecomputeIfAbsent()method already handles the null check and only computes the value if absent. Consider simplifying to: