-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
query_executor: Record WaitingForConnection
stat in all cases
#15073
query_executor: Record WaitingForConnection
stat in all cases
#15073
Conversation
The `WaitingForConnection` stat is also needed in the error path for metrics and logging. Signed-off-by: Tyler Coleman <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Apply the same logic as `getConn`, i.e., record the stat even in error paths (for `getStreamConn`). Signed-off-by: Tyler Coleman <[email protected]>
WaitingForConnection
stat in all casesWaitingForConnection
stat in all cases
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.
It will be good to add a unit test. There should be some existing stats tests that you can either extend or use as a pattern.
@@ -778,9 +778,10 @@ func (qre *QueryExecutor) getConn() (*connpool.PooledConn, error) { | |||
start := time.Now() | |||
conn, err := qre.tsv.qe.conns.Get(ctx, qre.setting) | |||
|
|||
qre.logStats.WaitingForConnection += time.Since(start) |
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.
It's probably better to do this in a defer call right after start
is initialized. That will be future-proof.
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.
@systay @harshit-gangal should we require an issue for this change? |
Wrapping the stat increment in a defer function future-proofs these changes by always incrementing the stat before returning from the surrounding function. Signed-off-by: Tyler Coleman <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #15073 +/- ##
==========================================
+ Coverage 47.29% 47.71% +0.41%
==========================================
Files 1137 1155 +18
Lines 238684 240225 +1541
==========================================
+ Hits 112895 114625 +1730
+ Misses 117168 117001 -167
+ Partials 8621 8599 -22 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Tyler Coleman <[email protected]>
Signed-off-by: Tyler Coleman <[email protected]>
For completeness. Signed-off-by: Tyler Coleman <[email protected]>
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
Ignoring this for now until we get all CodeCov quirks sorted out. |
Description
Record the
WaitingForConnection
stat whether or not the connection succeeds. This stat is needed in the error path for metrics and logging.Related Issue(s)
Checklist
Deployment Notes
N/A