Title: (google-cloud-spanner) Built-in metrics fail when one process uses databases in different projects · Issue #18155 · googleapis/google-cloud-python · GitHub
Open Graph Title: (google-cloud-spanner) Built-in metrics fail when one process uses databases in different projects · Issue #18155 · googleapis/google-cloud-python
X Title: (google-cloud-spanner) Built-in metrics fail when one process uses databases in different projects · Issue #18155 · googleapis/google-cloud-python
Description: Environment details OS type and version: Linux (also happens on macOS) Python version: 3.13 google-cloud-spanner version: 3.68.0 Steps to reproduce In one process, create two clients for databases in two different projects. Run a query o...
Open Graph Description: Environment details OS type and version: Linux (also happens on macOS) Python version: 3.13 google-cloud-spanner version: 3.68.0 Steps to reproduce In one process, create two clients for databases ...
X Description: Environment details OS type and version: Linux (also happens on macOS) Python version: 3.13 google-cloud-spanner version: 3.68.0 Steps to reproduce In one process, create two clients for databases ...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/18155
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"(google-cloud-spanner) Built-in metrics fail when one process uses databases in different projects","articleBody":"#### Environment details\n\n- OS type and version: Linux (also happens on macOS)\n- Python version: 3.13\n- `google-cloud-spanner` version: 3.68.0\n\n#### Steps to reproduce\n\n1. In one process, create two clients for databases in two different projects.\n2. Run a query on each.\n3. Wait a minute for the metrics export.\n\n#### Code example\n\n```python\nfrom google.cloud import spanner\n\na = spanner.Client(project=\"project-a\")\nb = spanner.Client(project=\"project-b\")\n\na.instance(\"i\").database(\"d\").snapshot().execute_sql(\"SELECT 1\")\nb.instance(\"i\").database(\"d\").snapshot().execute_sql(\"SELECT 1\")\n```\n\n#### What happens\n\nThe metrics export fails, and no metrics show up in Cloud Monitoring for either project:\n\n```\nInvalidArgument: 400 Field resource.labels.project_id had an invalid value of\n\"project-b\": if present, must be the project number or ID in the request name\n(projects/project-a).\n```\n\nWhichever client is created first decides where all metrics go, so everything from the other project is rejected — and it takes the first project's metrics down with it, since they're sent in the same request.\n\n#### What I expected\n\nMetrics for each database go to that database's project. Running against several projects is pretty normal, and right now it means no built-in metrics at all.\n\n#### What I tried\n\n`SPANNER_DISABLE_BUILTIN_METRICS=true` and `Client(disable_builtin_metrics=True)` both work, but only by giving up the metrics. As far as I can tell there's no way to pass in my own exporter or meter provider, so there's no way to keep them. Java has this (googleapis/google-cloud-java#13679) and there's an open request for Go (googleapis/google-cloud-go#11204), but I couldn't find anything similar here.\n","author":{"url":"https://github.com/zoola969","@type":"Person","name":"zoola969"},"datePublished":"2026-08-19T11:01:01Z","url":"https://github.com/googleapis/google-cloud-python/issues/18155"}
| 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:23b4a2cc-a892-a7e1-f869-da7634c61df9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D86:2B1963:ACE5ED:EAD703:6AFE696A |
| html-safe-nonce | 440152bb204f0dcac4e32ecc674f90e4267a4cf84c86fc530a9f5a125b17cd6d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDg2OjJCMTk2MzpBQ0U1RUQ6RUFENzAzOjZBRkU2OTZBIiwidmlzaXRvcl9pZCI6IjM1Nzc2NTIwNDkzNDIyNjE2MTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 953c6889a6acc9331be84f47bda6b1c85c0fa8a8f38aa6b5f9076d3f2b4bb883 |
| hovercard-subject-tag | issue:5191884947 |
| 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/18155/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eafa3d009954648a8544ca7d3c0abe8bf73f5cafa3402f519af4a392362ba4ef/googleapis/google-cloud-python/issues/18155 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eafa3d009954648a8544ca7d3c0abe8bf73f5cafa3402f519af4a392362ba4ef/googleapis/google-cloud-python/issues/18155 |
| og:image:alt | Environment details OS type and version: Linux (also happens on macOS) Python version: 3.13 google-cloud-spanner version: 3.68.0 Steps to reproduce In one process, create two clients for databases ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zoola969 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| 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 | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width