(google-cloud-spanner) Built-in metrics fail when one process uses databases in different projects
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- google-cloud, python
研究方向
首先使用 google-cloud-spanner 3.68.0 執行提供的雙專案範例,並檢查 spanner.Client 使用的內建指標路徑。將預設行為與 SPANNER_DISABLE_BUILTIN_METRICS 和 Client(disable_builtin_metrics=True) 進行比較,然後追蹤第一個用戶端的專案在匯出期間如何被重複使用。完成的標準是:每個資料庫的指標都到達各自的專案,同時不停用內建指標。
由索引模型根據 Issue 內容生成。
描述
Environment details
- OS type and version: Linux (also happens on macOS)
- Python version: 3.13
google-cloud-spannerversion: 3.68.0
Steps to reproduce
- In one process, create two clients for databases in two different projects.
- Run a query on each.
- Wait a minute for the metrics export.
Code example
from google.cloud import spanner
a = spanner.Client(project="project-a")
b = spanner.Client(project="project-b")
a.instance("i").database("d").snapshot().execute_sql("SELECT 1")
b.instance("i").database("d").snapshot().execute_sql("SELECT 1")
What happens
The metrics export fails, and no metrics show up in Cloud Monitoring for either project:
InvalidArgument: 400 Field resource.labels.project_id had an invalid value of
"project-b": if present, must be the project number or ID in the request name
(projects/project-a).
Whichever 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.
What I expected
Metrics 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.
What I tried
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.
- 主要語言
- Python
- 星號
- 5.4k
- 分支
- 1.8k
- 平均合併
- 2 天 6 小時
- 30 天內合併 PR
- 197
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
googleapis/google-cloud-python 的其他 Issue
-
api: spanner type: feature request
難度 2/5 1-3 小時 新手友好度 68/100
googleapis/google-cloud-python#18584 ·
維護者通常 1 天內回覆
-
auth: call_client_cert_callback() discards passphrase for encrypted keys可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 1/5 1-3 小時 新手友好度 92/100
googleapis/google-cloud-python#18467 ·
維護者通常 1 天內回覆
-
auth: `impersonated_credentials` loses `subject` on copy, so `with_scopes()` and `with_quota_project()` turn off domain wide delegation可能已有人在做 @Om-singhaI 於 29 天前認領。 未關閉auth priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 88/100
googleapis/google-cloud-python#18428 ·
維護者通常 1 天內回覆
-
priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 72/100
googleapis/google-cloud-python#18375 · 1 則留言 ·
維護者通常 1 天內回覆
-
ci: enable --strict flag in presubmit twine_check可能已有人在做 @ohmayr 於 18 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 76/100
googleapis/google-cloud-python#18339 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 googleapis/google-cloud-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 83/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
google-ai-edge/litert-torch#1346 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
geneontology/gocam-py#272 ·
-
pushed_authorization_request sends list authorization_details as a Python repr可能已有人在做 @RaphaelFakhri 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
auth0/auth0-python#903 ·
維護者通常 1 天內回覆