feat: support dequeue event to properly match enqueue counterpart#2250
Open
odubuc wants to merge 1 commit intosidorares:masterfrom
Open
feat: support dequeue event to properly match enqueue counterpart#2250odubuc wants to merge 1 commit intosidorares:masterfrom
odubuc wants to merge 1 commit intosidorares:masterfrom
Conversation
Collaborator
|
LGTM 🚀 |
|
Any chance of getting this one merged? |
Author
|
Not sure what is holding the merge. This is my first PR on this repo |
Collaborator
Hey @odubuc, when your PR was created, I was new here, so I didn't have the inclination to merge new features at that time (at most, review them). Your approach is consistent with similar events and there are also tests covering your changes. If you want to go for a rebase, I'd be happy to merge 🙋🏻♂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on current event exposed, we can hook to
"connecttion" -> to know when a new connection is created in the pool
"acquire" -> to know when a connection was acquired from the pool
"release" -> to know when a connection was released back into the pool
"enqueue" -> to know when a query was sent to the pool and went to the queue to be processed later. ( > connectionLimit )
The problem arise when we want to know how the queue is doing. it's either going up and up and up with the enqueue event OR we can assume the queue is 0 when "release" is triggered.
Proposed change; a new "dequeue" event that is triggered every time a query is taken from "_connectionQueue" in the pool. This way metrics can be correctly plugged into mysql2 to know how fast the queue is unstacking.
Code to reproduce before and after the fix
Logs that are shown before proposed changed
logs after the proposed fix :