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

query_executor: Record WaitingForConnection stat in all cases #15073

Merged
merged 6 commits into from
Jan 31, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions go/vt/vttablet/tabletserver/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

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.

Copy link
Contributor Author

@tycol7 tycol7 Jan 30, 2024

Choose a reason for hiding this comment

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


switch err {
case nil:
qre.logStats.WaitingForConnection += time.Since(start)
return conn, nil
case connpool.ErrConnPoolClosed:
return nil, err
Expand All @@ -794,9 +795,11 @@ func (qre *QueryExecutor) getStreamConn() (*connpool.PooledConn, error) {

start := time.Now()
conn, err := qre.tsv.qe.streamConns.Get(ctx, qre.setting)

qre.logStats.WaitingForConnection += time.Since(start)

switch err {
case nil:
qre.logStats.WaitingForConnection += time.Since(start)
return conn, nil
case connpool.ErrConnPoolClosed:
return nil, err
Expand Down
Loading