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

fix(spanner): attempt latency for streaming call should capture the total latency till decoding of protos #11039

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

rahul2393
Copy link
Contributor

No description provided.

@rahul2393 rahul2393 requested review from a team as code owners October 28, 2024 05:18
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Oct 28, 2024
@rahul2393 rahul2393 force-pushed the fix-stream-attempt-latencies branch from e895070 to 1bf1615 Compare October 28, 2024 07:13
@rahul2393 rahul2393 requested a review from olavloite October 28, 2024 07:13
@rahul2393 rahul2393 force-pushed the fix-stream-attempt-latencies branch from 1bf1615 to 82b19f0 Compare October 28, 2024 07:32
Copy link
Contributor

@olavloite olavloite left a comment

Choose a reason for hiding this comment

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

Do we have any way to test this? There are a lot of corner cases where we are retrying the query stream etc., and it is very hard to tell from just looking at the code that we actually cover all corner cases, and that it actually records the latency that we want it to record.

}
}
defer func() {
if mt.method != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could use a comment. Does mt.method != "" mean that the operation completed? Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment

spanner/read.go Outdated Show resolved Hide resolved
spanner/read.go Outdated Show resolved Hide resolved
}
statusCode, _ := convertToGrpcStatusErr(r.err)
mt.currOp.setStatus(statusCode.String())
recordOperationCompletion(&mt)
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to indicate that we will record the latency of the last attempt that finished as the operation latency. That means that an operation that is retried will not contain the entire latency, but only the latency of the last attempt. Is that intentional? If so, could we document that in code to clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the currOp start time is initalised in first line of Next() and in recordOperationCompletion we capture to total time including multiple attempts latencies

Copy link
Contributor

Choose a reason for hiding this comment

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

Ack. I see now that there is a separate field for the operation start time.

spanner/read.go Outdated Show resolved Hide resolved
spanner/read.go Outdated Show resolved Hide resolved
spanner/read.go Outdated Show resolved Hide resolved
@rahul2393 rahul2393 force-pushed the fix-stream-attempt-latencies branch from 82b19f0 to d9edbe3 Compare October 28, 2024 09:22
@rahul2393 rahul2393 requested a review from olavloite October 28, 2024 09:30
@rahul2393 rahul2393 force-pushed the fix-stream-attempt-latencies branch 2 times, most recently from df2c835 to fea6538 Compare October 28, 2024 10:22
@rahul2393 rahul2393 force-pushed the fix-stream-attempt-latencies branch from fea6538 to 2404e56 Compare October 28, 2024 10:25
@rahul2393 rahul2393 merged commit 255c6bf into main Oct 29, 2024
9 checks passed
@rahul2393 rahul2393 deleted the fix-stream-attempt-latencies branch October 29, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants