-
Notifications
You must be signed in to change notification settings - Fork 34
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
Expose metrics for pending acquire
operation latency
#178
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 |
---|---|---|
|
@@ -366,7 +366,7 @@ private void drainLoop() { | |
borrower.fail(new PoolShutdownException()); | ||
return; | ||
} | ||
borrower.stopPendingCountdown(); | ||
borrower.stopPendingCountdown(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually followed by |
||
ACQUIRED.incrementAndGet(this); | ||
poolConfig.acquisitionScheduler() | ||
.schedule(() -> borrower.deliver(slot)); | ||
|
@@ -412,7 +412,7 @@ private void drainLoop() { | |
borrower.fail(new PoolShutdownException()); | ||
return; | ||
} | ||
borrower.stopPendingCountdown(); | ||
borrower.stopPendingCountdown(true); | ||
long start = clock.millis(); | ||
Mono<POOLABLE> allocator = allocatorWithScheduler(); | ||
|
||
|
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.
Assuming timeoutTask was disposed, what should happen with the pending metric?
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.
Isn't the pending metric per connection pool?
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 trying to understand - so if a borrower was just timed out, its result can be ignored, while the acquisition will actually account for recording the metric. Do I understand it right?
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.
!timeoutTask.isDisposed()
this check is to ensure that if you invoke this method twice for one and the sameBorrower
you will not record twice.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.
I mean
timeoutTask
is disposed here in this method at the end of the method, so we need to guarantee that we record just once.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.
If the task timed out the recording will happen in
run
method. Is that what you had in mind?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.
I now see what is happening. In another comment I expressed my concern about it. Now my question would be - is there no race here? Is the timeoutTask delivered serially with the acquisition or does it run on potentially another thread? In such case, perhaps the flip of the Borrower's AtomicBoolean state would be the trigger to account for either success or failure in the transitioning from pending state?