Comparing v3.62.0...v3.63.0 · googleapis/python-spanner
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
- 5 commits
- 48 files changed
- 4 contributors
Commits on Jan 16, 2026
-
chore: Add gcp resource name span attribute (#1480)
Adding a new span attribute called gcp.resource.name which contains an identifier to a particular spanner instance and database in the following format: //spanner.googleapis.com/projects/{project}/instances/{instance_id}/databases/{database_id} Example: //spanner.googleapis.com/projects/my_project/instances/my_instance/databases/my_database
Commits on Jan 22, 2026
-
feat: add requestID info in error exceptions (#1415)
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: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-spanner/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
Commits on Feb 11, 2026
-
fix(metrics): prevent thread leak by ensuring singleton initialization (
#1492) ****Summary:**** This PR fixes a critical memory and thread leak in the google-cloud-spanner client when built-in metrics are enabled (default behavior). Previously, the Client constructor unconditionally initialized a new OpenTelemetry MeterProvider and PeriodicExportingMetricReader on every instantiation. Each reader spawned a new background thread for metric exporting that was never cleaned up or reused. In environments where Client objects are frequently created (e.g., Cloud Functions, web servers, or data pipelines), this caused a linear accumulation of threads, leading to RuntimeError: can't start new thread and OOM crashes. ****Fix Implementation:**** ***Refactored Metrics Initialization (Thread Safety & Memory Leak Fix)***: Implemented a Singleton pattern for the OpenTelemetry MeterProvider using threading.Lock to prevent infinite background thread creation (memory leak). Moved metrics initialization logic to a cleaner helper function _initialize_metrics in client.py. Replaced global mutable state in SpannerMetricsTracerFactory with contextvars.ContextVar to ensure thread-safe, isolated metric tracing across concurrent requests. Updated MetricsInterceptor and MetricsCapture to correctly use the thread-local tracer. ***Fixed Batch.commit Idempotency (AlreadyExists Regression):*** Modified Batch.commit to initialize nth_request and the attempt counter outside the retry loop. This ensures that retries (e.g., on ABORTED) reuse the same Request ID, allowing Cloud Spanner to correctly deduplicate requests and preventing spurious AlreadyExists (409) errors. ***Verification:*** Added tests/unit/test_metrics_concurrency.py to verify tracer isolation and thread safety. Cleaned up tests/unit/test_metrics.py and consolidated mocks in conftest.py.
Commits on Feb 13, 2026
-
chore: librarian release pull request: 20260213T101303Z (#1497)
PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v1.0.0 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209 <details><summary>google-cloud-spanner: 3.63.0</summary> ## [3.63.0](v3.62.0...v3.63.0) (2026-02-13) ### Features * add requestID info in error exceptions (#1415) ([2c5eb96](2c5eb96c)) ### Bug Fixes * prevent thread leak by ensuring singleton initialization (#1492) ([e792136](e792136a)) ### Documentation * snippet for setting read lock mode (#1473) ([7e79920](7e79920c)) </details>