Skip to content

chore(spanner): trace server streaming queries and reads in ResultSet - #6204

Open
olavloite wants to merge 2 commits into
googleapis:mainfrom
olavloite:spanner-built-in-metrics-step-3
Open

chore(spanner): trace server streaming queries and reads in ResultSet#6204
olavloite wants to merge 2 commits into
googleapis:mainfrom
olavloite:spanner-built-in-metrics-step-3

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Trace ExecuteStreamingSql and StreamingRead operation latencies across stream initialization and first result delivery.

@olavloite
olavloite requested review from a team as code owners July 29, 2026 10:44
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Jul 29, 2026
@olavloite
olavloite requested a review from sakthivelmanii July 29, 2026 10:44

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces built-in metrics and observability support for Spanner streaming operations, such as streaming SQL and streaming reads, by propagating an Observability instance and method names through transaction and result set parameters. The feedback highlights a critical issue where the disabled Observability instance from the inner Spanner client (client.spanner.o11y) is used instead of the active one from the DatabaseClient (client.o11y), which would prevent metrics from being recorded.

Comment thread src/spanner/src/batch_read_only_transaction.rs Outdated
Comment thread src/spanner/src/batch_read_only_transaction.rs Outdated
Comment thread src/spanner/src/read_only_transaction.rs Outdated
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.08%. Comparing base (c5f374b) to head (d256714).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6204      +/-   ##
==========================================
+ Coverage   96.04%   96.08%   +0.04%     
==========================================
  Files         269      269              
  Lines       68390    68440      +50     
==========================================
+ Hits        65686    65763      +77     
+ Misses       2704     2677      -27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@olavloite
olavloite force-pushed the spanner-built-in-metrics-step-3 branch from 5920ee5 to f4ee223 Compare July 29, 2026 13:40
@olavloite

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request integrates observability and metrics tracking into Spanner's streaming operations. Specifically, it updates ResultSetParams to include o11y (observability) and method_name fields, allowing streaming SQL and read operations to trace their execution. The Observability struct was updated to be cloneable by wrapping its internal metrics and provider in Arc, and comprehensive unit tests were added to verify the new observability features. There are no review comments, and we have no feedback to provide.

Trace ExecuteStreamingSql and StreamingRead operation latencies across
stream initialization and first result delivery.
@olavloite
olavloite force-pushed the spanner-built-in-metrics-step-3 branch from f4ee223 to 6af98c4 Compare July 29, 2026 15:35
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.

1 participant