You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This suggests the Query elasped milliseconds comes before the query has been sent to Spanner. So I am unclear of the value. Would it be better to show the duration between the Start, Send, Received, Closed? Maybe even the server execution time if available:
Thanks @guycall for reporting this issue! I reproduce it locally also. In short, this is a bug in our logging and Query elasped milliseconds currently dose not provide any value.
Cloud Spanner Java client library actually delay the execution of query until the first call to ResultSet#next(), this behavior is implemented as follows:
That stream is started the first time ResultSet#next() is called.
Special thanks to @olavloite for providing the above additional context!
Regarding what we can do in spring-cloud-gcp, I don't think we can provide additional log regarding Start, Send, Received, Closed, because it's up to the caller to decide when to actually call ResultSet#next(). We are probably going to delete the misleading logs you identified.
Cloud Spanner Java client library actually delay the execution of query until the first call to ResultSet#next(), hence we can not provide an accurate query elapsed time in spring-cloud-gcp.
In addition, change SpannerOperations to SpannerTemplate in Spanner sample to align with other samples.
Fixes: #1945
For each executed Spanner query I get the log line:
In nearly ever instance the value is 0ms (and occasionally 1ms). Is this showing anything useful? Could it be improved?
It gets generated by this code https://github.com/GoogleCloudPlatform/spring-cloud-gcp/blob/main/spring-cloud-gcp-data-spanner/src/main/java/com/google/cloud/spring/data/spanner/core/SpannerTemplate.java#L510
When I switch on higher logging levels I see the following additonal details:
This suggests the
Query elasped milliseconds
comes before the query has been sent to Spanner. So I am unclear of the value. Would it be better to show the duration between the Start, Send, Received, Closed? Maybe even the server execution time if available:The text was updated successfully, but these errors were encountered: