Title: Record streaming attempt and front-end metrics when PartialResultSet.last=True is observed · Issue #18656 · googleapis/google-cloud-python · GitHub
Open Graph Title: Record streaming attempt and front-end metrics when PartialResultSet.last=True is observed · Issue #18656 · googleapis/google-cloud-python
X Title: Record streaming attempt and front-end metrics when PartialResultSet.last=True is observed · Issue #18656 · googleapis/google-cloud-python
Description: Description In google-cloud-spanner, streaming queries that receive PartialResultSet.last = True hand off the underlying response iterator to _GLOBAL_STREAM_DRAINER to drain trailing metadata to EOF asynchronously on a background worker ...
Open Graph Description: Description In google-cloud-spanner, streaming queries that receive PartialResultSet.last = True hand off the underlying response iterator to _GLOBAL_STREAM_DRAINER to drain trailing metadata to EO...
X Description: Description In google-cloud-spanner, streaming queries that receive PartialResultSet.last = True hand off the underlying response iterator to _GLOBAL_STREAM_DRAINER to drain trailing metadata to EO...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/18656
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Record streaming attempt and front-end metrics when PartialResultSet.last=True is observed","articleBody":"### Description\n\nIn `google-cloud-spanner`, streaming queries that receive `PartialResultSet.last = True` hand off the underlying response iterator to `_GLOBAL_STREAM_DRAINER` to drain trailing metadata to EOF asynchronously on a background worker thread (in `snapshot.py`).\n\nHowever, `_StreamingResponseWrapper` in `metrics_interceptor.py` currently defers recording attempt completion (`attempt_latencies`) and front-end timing metrics (`gfe_latencies`, `afe_latencies`) until `StopIteration` is raised:\nhttps://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-spanner/google/cloud/spanner_v1/metrics/metrics_interceptor.py\n\nThis causes two issues:\n1. **Metric Timing Inaccuracy**: Attempt latency should measure when the operation actually completes from an outside observer's perspective (i.e. when `PartialResultSet.last = True` is received by the caller), rather than including time spent waiting in the background drainer queue or consuming trailing stream metadata.\n2. **Race Condition with Metrics Readers**: Callers that complete a query and immediately collect or inspect metrics observe missing `attempt_latencies`, `gfe_latencies`, and `afe_latencies` because the background drainer thread has not yet reached EOF.\n\n### Proposed Solution\n\nThe client should measure attempt completion and record front-end metrics as soon as `PartialResultSet.last == True` is observed on the stream, rather than waiting for `StopIteration` during background stream draining.","author":{"url":"https://github.com/olavloite","@type":"Person","name":"olavloite"},"datePublished":"2026-10-13T09:55:49Z","url":"https://github.com/googleapis/google-cloud-python/issues/18656"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4ce6d5e6-82aa-9fb7-f3c8-d35e8f3566b6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8840:66EFA:9E092:D5531:6AFE1F66 |
| html-safe-nonce | 17f24eae6a28edc9a9c32af66c70da741eba1668b99cb8e1c8174c25c8c5cbb9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODQwOjY2RUZBOjlFMDkyOkQ1NTMxOjZBRkUxRjY2IiwidmlzaXRvcl9pZCI6IjYwMzI2NjM4OTQxMzA4MjcxMTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5c0f06210e79cb46c4dd30b4e6a408db5c68dc3e2ca41e192a5af55c5bd6b200 |
| hovercard-subject-tag | issue:5828263985 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/18656/issue_layout |
| twitter:image | https://opengraph.githubassets.com/db63351c97d9dec13dc48ad54227a9c63d3a098cb5a8300ed91e2b637440e18d/googleapis/google-cloud-python/issues/18656 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/db63351c97d9dec13dc48ad54227a9c63d3a098cb5a8300ed91e2b637440e18d/googleapis/google-cloud-python/issues/18656 |
| og:image:alt | Description In google-cloud-spanner, streaming queries that receive PartialResultSet.last = True hand off the underlying response iterator to _GLOBAL_STREAM_DRAINER to drain trailing metadata to EO... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | olavloite |
| hostname | github.com |
| expected-hostname | github.com |
| None | d0525ab1464526bf4532a5551aa348cf100dff75ef808a96fc67a08b1d946aa9 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fef3993a71fa20f7be8e167132fbf9619bc66e12 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width