bigquery-observability
它能做什么
这个技能帮你查看 BigQuery 作业的运行情况。它适用于想看清哪些查询慢或花费高,并弄清原因的人。
适用场景
- ✓当你想查看一段时间内哪些 BigQuery 查询运行缓慢或花费最多的时候。
- ✓当你需要某个 BigQuery 作业的详细信息,以查看它的时间都花在哪里的时候。
- ✓当你想监控 BigQuery 中的槽位使用或预留的时候。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/bigquery-observability/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请告诉我上周哪些 BigQuery 查询最慢,并且花费最多。”
每周 5 个新技能,1 分钟读完。
工作原理
它会根据你的问题选择合适的数据来源,例如查询历史表或单个作业的查询。然后它会编写高效的查询来获取信息。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
BigQuery Observability
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-observability)"
and append agent-skills/1.0 (skill:bigquery-observability) to User-Agent headers.
Tool Selection
<!-- mdformat off -->| Tool | Primary Use Cases | Strengths & Capabilities | When to Avoid / Limitations |
|---|---|---|---|
INFORMATION_SCHEMA (I_S) |
Historical analysis, cohort comparison (normalized_literals), discovery of fast/slow windows, reservation/project timelines, multi-job aggregates, cost/billing tracing. |
Flexible SQL querying across JOBS, JOBS_TIMELINE, and RESERVATIONS; supports custom time windows and grouping. |
Avoid for high-frequency real-time polling or single-job point-lookups (can consume slots and take seconds to execute). |
REST API (jobs.api / reservation.api) |
Single-job point-lookup, real-time stage bottleneck diagnosis, automated pipeline status checks, reservation/capacity commitment configuration inspection (reservations.get, reservations.list). |
Zero-SQL overhead, fast REST/CLI point-lookups (bq show -j, bq show --reservation), instant access to performanceInsights, queryPlan, and structural metadata. |
Avoid for aggregate analysis across thousands of jobs, cross-project historical comparison, or system timeline aggregations. |
Cloud Monitoring (Metrics Explorer / Charts) |
Real-time alerting, fleet-wide dashboards, continuous slot utilization tracking, high-level SLA/SLO monitoring. | Out-of-the-box charts for slot utilization, query throughput, PENDING queue depth, and execution latency; low-latency alerting without running queries. |
Avoid for SQL-level debugging, individual query text inspection, or stage-level execution detail. |
Prerequisites & Environment Setup
Before retrieving telemetry or running observability queries, ensure the Google Cloud environment and project are configured:
Google Cloud SDK: Ensure the Google Cloud SDK is installed and configured.
Project Selection: Set the active Google Cloud project:
gcloud config set project {project_id}API Enablement: Ensure the BigQuery and Cloud Monitoring APIs are enabled:
gcloud services enable bigquery.googleapis.com monitoring.googleapis.comAuthentication: Authenticate the environment:
- CLI queries and
bqcommands:gcloud auth login - SDKs and automated client tools:
gcloud auth application-default login - Service accounts: Set
GOOGLE_APPLICATION_CREDENTIALS="/path/to/key.json"
- CLI queries and
Billing & IAM Roles:
- Verify an active Google Cloud Billing account is attached to
{project_id}. - Ensure appropriate IAM roles:
roles/bigquery.jobUser: Running telemetry queries.roles/bigquery.resourceViewerorroles/bigquery.admin: Organization-level jobs and reservation telemetry.roles/monitoring.viewer: Cloud Monitoring metrics.
- Verify an active Google Cloud Billing account is attached to
Companion Skills Installation: This skill is part of a 3-pillar operations suite (
bigquery-observability,bigquery-optimization,bigquery-troubleshooting). If any companion skill is not yet installed in your environment, install the full suite:npx skills add google/skills --skill bigquery-observability --skill bigquery-optimization --skill bigquery-troubleshooting
Workflow
Single-Job Point-Lookup (Zero-SQL Overhead): For single-job slowness or inspection, always prioritize the REST API or CLI (
bq show -j) first. It provides zero-SQL overhead and fast point-lookups for internal stage bottlenecks (performanceInsights,queryPlan, shuffle spill).bq show --location={location} -j {project_id}:{job_id}Diagnostic Transition Logic: If no job-level issues are found (e.g. no clear internal bottlenecks), the investigation should transition to system-level
INFORMATION_SCHEMAqueries (such asJOBS_TIMELINEorRESERVATIONS_TIMELINE) to check for broader is
常见问题
它会更改我的 BigQuery 设置吗?
不会。它的主要工作是获取遥测数据,所以只读取数据,不更改资源。
为什么要避免过于频繁地检查?
频繁查询历史可能会占用槽位,并耗时数秒,因此更适合分析,而不适合实时轮询。
什么是 INFORMATION_SCHEMA?
它是 BigQuery 内置的一组视图,记录过去的作业、时间线和预留。
详情
作者的原始描述
Provides data-retrieval best practices, tool selection guidance, and performant SQL query syntax for BigQuery telemetry across INFORMATION_SCHEMA, Cloud Monitoring, and the REST API. Use when the telemetry to fetch is already known, selecting telemetry tools, writing performant INFORMATION_SCHEMA queries, retrieving telemetry for diagnosing single-job performance bottlenecks, investigating slot contention, job concurrency and queue latency, analyzing reservation capacity, utilization and autoscaling saturation, or auditing capacity-based and on-demand compute and storage resource billable usag
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10228
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。