fix: Provide Spanner Option to disable metrics by surbhigarg92 · Pull Request #1460 · googleapis/python-spanner · GitHub
Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

fix: Provide Spanner Option to disable metrics#1460

Merged
surbhigarg92 merged 1 commit into
mainfrom
disable_metrics_option
Dec 9, 2025
Merged

fix: Provide Spanner Option to disable metrics#1460
surbhigarg92 merged 1 commit into
mainfrom
disable_metrics_option

Conversation

@surbhigarg92

@surbhigarg92 surbhigarg92 commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

BEGIN_COMMIT_OVERRIDE
fix: Provide option to disable metrics via SpannerOption.
Release-As: 3.60.0
END_COMMIT_OVERRIDE

@surbhigarg92 surbhigarg92 requested review from a team December 9, 2025 10:17
@product-auto-label product-auto-label Bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/python-spanner API. labels Dec 9, 2025
@gemini-code-assist

Copy link
Copy Markdown
Contributor

@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 a new option disable_builtin_metrics to the Spanner Client constructor, allowing users to programmatically disable the built-in metrics collection. The implementation correctly considers both this new option and the existing environment variable SPANNER_DISABLE_BUILTIN_METRICS. The changes are well-tested, though there is a minor issue in a test docstring. Overall, this is a good addition for providing more control over metrics.

Comment thread tests/unit/test_client.py
Comment on lines +286 to +288
"""
Test that Client constructor disable metrics using Spanner Option.
"""

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.

medium

The docstring seems to be a copy-paste from the test below. It should describe that this test validates disabling metrics via the environment variable, not the Spanner option.

Suggested change

@surbhigarg92 surbhigarg92 merged commit f1ebc43 into main Dec 9, 2025
21 of 22 checks passed
@surbhigarg92 surbhigarg92 deleted the disable_metrics_option branch December 9, 2025 10:48
@surbhigarg92 surbhigarg92 added the release-please:force-run To run release-please label Dec 9, 2025
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 9, 2025
@surbhigarg92 surbhigarg92 added the release-please:force-run To run release-please label Dec 10, 2025
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 10, 2025
@surbhigarg92 surbhigarg92 added the release-please:force-run To run release-please label Dec 10, 2025
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 10, 2025
@surbhigarg92 surbhigarg92 added the release-please:force-run To run release-please label Dec 10, 2025
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 10, 2025
@surbhigarg92 surbhigarg92 added the release-please:force-run To run release-please label Dec 10, 2025
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 10, 2025
@surbhigarg92 surbhigarg92 added the release-please:force-run To run release-please label Dec 10, 2025
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 10, 2025
gcf-merge-on-green Bot pushed a commit that referenced this pull request Dec 10, 2025
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:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91
<details><summary>google-cloud-spanner: 3.60.0</summary>

## [3.60.0](https://togithub.com/googleapis/python-spanner/compare/v3.59.0...v3.60.0) (2025-12-10)

### Features

* make built-in metrics enabled by default (#1459) ([64aebe7](https://togithub.com/googleapis/python-spanner/commit/64aebe7e))

* Exposing AutoscalingConfig in InstancePartition ([8b6f154](https://togithub.com/googleapis/python-spanner/commit/8b6f1540))

* add support for experimental host (#1452) ([9535e5e](https://togithub.com/googleapis/python-spanner/commit/9535e5e0))

* enable OpenTelemetry metrics and tracing by default (#1410) ([bb5095d](https://togithub.com/googleapis/python-spanner/commit/bb5095df))

* add cloud.region, request_tag and transaction_tag in span attributes (#1449) ([d37fb80](https://togithub.com/googleapis/python-spanner/commit/d37fb80a))

* Add QueryAdvisorResult for query plan (PiperOrigin-RevId: 832425466) ([e08260f](https://togithub.com/googleapis/python-spanner/commit/e08260fe))

* Add Send and Ack mutations for Queues (PiperOrigin-RevId: 832425466) ([e08260f](https://togithub.com/googleapis/python-spanner/commit/e08260fe))

* Add Spanner location API (#1457) (PiperOrigin-RevId: 833474957) ([e08260f](https://togithub.com/googleapis/python-spanner/commit/e08260fe))

### Bug Fixes

* Deprecate credentials_file argument ([8b6f154](https://togithub.com/googleapis/python-spanner/commit/8b6f1540))

* configure keepAlive time for gRPC TCP connections (#1448) ([efb2833](https://togithub.com/googleapis/python-spanner/commit/efb2833e))

* Provide Spanner Option to disable metrics (#1460) ([f1ebc43](https://togithub.com/googleapis/python-spanner/commit/f1ebc43b))

### Documentation

* Update description for the BatchCreateSessionsRequest and Session (PiperOrigin-RevId: 832425466) ([e08260f](https://togithub.com/googleapis/python-spanner/commit/e08260fe))

* Update description for the IsolationLevel (PiperOrigin-RevId: 832425466) ([e08260f](https://togithub.com/googleapis/python-spanner/commit/e08260fe))

</details>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/python-spanner API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants