Skip to content

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

Merged
rahul2393 merged 3 commits intomainfrom
fix-stream-attempt-latencies
Oct 29, 2024
Merged

fix(spanner): attempt latency for streaming call should capture the total latency till decoding of protos#11039
rahul2393 merged 3 commits intomainfrom
fix-stream-attempt-latencies

Conversation

@rahul2393
Copy link
Copy Markdown
Contributor

No description provided.

@rahul2393 rahul2393 requested review from a team 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

}
statusCode, _ := convertToGrpcStatusErr(r.err)
mt.currOp.setStatus(statusCode.String())
recordOperationCompletion(&mt)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@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
@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