test(spanner): fix AFE server timing metadata failures in prerelease tests - #17970
Open
sakthivelmanii wants to merge 1 commit into
Open
test(spanner): fix AFE server timing metadata failures in prerelease tests#17970sakthivelmanii wants to merge 1 commit into
sakthivelmanii wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the unit tests across the Google Cloud Spanner Python client to assert that the "x-goog-spanner-enable-afe-server-timing" metadata header is set to "true" on all relevant gRPC requests. This change affects both synchronous and asynchronous test suites for clients, databases, sessions, transactions, snapshots, and instances. No review comments were provided, so I have no additional feedback to offer.
sakthivelmanii
force-pushed
the
fix-spanner-prerelease-deps-afe-metadata
branch
3 times, most recently
from
August 2, 2026 07:10
e5260b3 to
56fa705
Compare
In prerelease-deps CI sessions, OpenTelemetry prerelease packages import google.cloud.spanner_v1 before conftest.py executes. Consequently, _helpers.ENABLE_AFE_SERVER_TIMING evaluated to True in prerelease-deps, emitting x-goog-spanner-enable-afe-server-timing headers and breaking 356 unit tests. By setting SPANNER_DISABLE_AFE_SERVER_TIMING='true' in the env dictionary of unit test sessions in noxfile.py, AFE server timing is disabled in the subprocess environment before pytest is launched. This ensures ENABLE_AFE_SERVER_TIMING evaluates to False consistently across all unit test sessions without needing to modify any unit test files or production code. Additionally, the metrics_tracer fixture in test_metrics_tracer.py explicitly sets tracer.afe_server_timing_enabled = True so tracer unit tests continue to test AFE latency recording.
sakthivelmanii
force-pushed
the
fix-spanner-prerelease-deps-afe-metadata
branch
from
August 2, 2026 07:30
56fa705 to
96f8d53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The AFE server timing metric header ('x-goog-spanner-enable-afe-server-timing') is enabled by default in Spanner client helper methods (_helpers.py). Consequently, _metadata_with_prefix appends ('x-goog-spanner-enable-afe-server-timing', 'true') to all client RPC request metadata.
This commit updates expected metadata tuples across 12 synchronous and asynchronous Spanner unit test files (254 assertions updated) to explicitly include ('x-goog-spanner-enable-afe-server-timing', 'true'), resolving 356 assertion failures in prerelease-deps CI test sessions.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕