cloud-trace-querying
Skill này làm gì
Skill này tìm trong các trace yêu cầu trên Google Cloud để tìm các lệnh gọi chậm hoặc bị lỗi. Skill dành cho lập trình viên muốn biết bước nào của yêu cầu gây ra vấn đề.
Khi nào nên dùng
- ✓Khi các yêu cầu đến một dịch vụ Google Cloud bị chậm và bạn cần xem bước nào chịu trách nhiệm.
- ✓Khi bạn muốn lọc trace theo ngưỡng độ trễ hoặc theo trạng thái lỗi.
- ✓Khi bạn cần ghép một trace phân tán với các mục Cloud Logging của nó.
Liên kết skill
https://github.com/google/skills/blob/main/skills/cloud/cloud-trace-querying/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tìm các yêu cầu đến dịch vụ checkout của tôi trong một giờ qua mất hơn hai giây, và cho tôi biết bước nào chậm.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill chạy các công cụ đi kèm để truy vấn Cloud Trace, lấy cấu trúc phân cấp của trace và báo cáo kết quả chính xác. Skill dùng các kết quả đó để chỉ ra những bước tốn nhiều thời gian nhất.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Cloud Trace Querying Skill (cloud-trace-querying)
This skill equips the agent to interact with Cloud Trace by providing standard query patterns, diagnostic workflows for latency and errors, and tools to fetch and inspect trace hierarchies.
[!IMPORTANT] AUTONOMOUS TOOL EXECUTION MANDATE: You MUST execute the tool scripts directly in bash to query telemetry. Do NOT just describe query strings or write Python scripts. Run the provided bash tools directly and report the exact results.
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:cloud-trace-querying)"
and append agent-skills/1.0 (skill:cloud-trace-querying) to User-Agent headers.
Prerequisites & Setup
- Google Cloud SDK: Verify
gcloudis installed (Installation Guide). - Authentication: Authenticate CLI and application default credentials:
gcloud auth login && gcloud auth application-default login - Project & Billing: Identify the target
<PROJECT_ID>(from the user's prompt or viabash scripts/get_trace_project/run.sh), ensure an active billing account is attached, and configure the project if not already set:gcloud config set project <PROJECT_ID> - API Enablement: Verify Cloud Trace and Cloud Logging APIs are enabled:
gcloud services enable cloudtrace.googleapis.com logging.googleapis.com
Quickstart Workflows
1. Identify Google Cloud Project ID
If the user specified a Google Cloud project ID in their prompt, use it.
If they did not, ALWAYS determine the Google Cloud project ID by running:
bash scripts/get_trace_project/run.sh
2. Search Traces (Latency & Errors)
To find traces matching specific criteria, such as a root span of /v1/booking/book with a duration of at least 1.5s:
bash scripts/search_traces/run.sh --filter 'root:/v1/booking/book latency:1.5s' --projects '<PROJECT_ID>'
Note: --filter is required. To list traces without specific filtering, pass --filter '' or --filter 'root:'.
Filter syntax: The Cloud Trace API uses latency:<duration> (such as latency:1.5s for duration >= 1.5s), which corresponds to "Span duration" in Trace Explorer.
The script outputs JSON where each cluster's examples array contains sample trace objects with trace_id, duration_seconds, span count, and error status.
3. Fetch Entire Trace Hierarchy
To view all spans and status codes/labels within a trace:
bash scripts/fetch_entire_trace/run.sh --trace-id '<TRACE_ID>' --project '<PROJECT_ID>'
4. Fetch Correlated Application Logs
To retrieve application log entries correlated with a trace ID:
bash scripts/fetch_related_logs/run.sh --trace-id '<TRACE_ID>' --trace-projects '<PROJECT_ID>'
Application log entries are useful when inspecting stack traces, exception messages, and log events emitted during span execution. When diagnosing errors or service crashes, inspect the returned log entries for severity: "ERROR" to confirm root causes or uncover unhandled exceptions.
Note: fetch_related_logs queries the default log scope (_Default), searching across configured log views in the target project. An empty response can occur if: (1) no log entries match the criteria, (2) the caller lacks IAM permissions to view the matching entries, or (3) matching entries reside in log views outside the searched log scope.
5. Fetch Specific Trace Span
To inspect attributes and metadata of a single span within a trace:
bash scripts/fetch_trace_span/run.sh --trace-id '<TRACE_ID>' --span-id '<SPAN_ID>' --project '<PROJECT_ID>'
6. Generate Cloud Console Deep Links
To generate direct Cloud Console URLs for browser inspection of traces or correlated logs:
bash scripts/generate_links/run.sh --trace-id '<TRACE_ID>' --project '<PROJECT_ID>' [--span-id '<SPAN_ID>']
7. Format Output
- Terminal / CLI: Render span trees as indented ASCII timelines using
|--. - UI Presentation: Render as A2UI JSON graph structures when requested for UI.
8. Upstream Service Error Handling
If the Cloud Trace API or Cloud Logging A
Câu hỏi thường gặp
Skill có làm việc với dữ liệu tracing của nhà cung cấp khác không?
Không. Skill chỉ dành cho Cloud Trace trên Google Cloud.
Cần thiết lập gì?
Google Cloud SDK, đăng nhập cho cả CLI lẫn application default credentials, và một tài khoản thanh toán đang hoạt động.
Skill có tối ưu được truy vấn cơ sở dữ liệu không?
Không. Tối ưu truy vấn cơ sở dữ liệu ngoài Cloud Trace nằm ngoài phạm vi của skill.
Chi tiết
Mô tả gốc của tác giả
Query Cloud Trace spans, filter by latency thresholds or error status, correlate distributed traces with Cloud Logging, and diagnose latency bottlenecks across Google Cloud services. Use when investigating slow requests, analyzing trace hierarchies, or resolving latency regressions. Do NOT use for querying non-GCP telemetry or database query optimization outside Cloud Trace.
repo: google/skills
Độ phổ biến
- Sao GitHub
- 22k
- Vị trí xếp hạng
- #10249
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
finding-google-skills
22kGiúp agent của bạn tìm hướng dẫn Google phù hợp cho việc thiết lập, như hosting, cơ sở dữ liệu, lưu trữ, đăng nhập hoặc phục vụ mô hình AI.
gcloud
22kGiúp agent của bạn viết và kiểm tra các lệnh gcloud của Google Cloud, tra cứu cú pháp chính xác trước khi chạy bất cứ thứ gì để không đoán các flag.
google-cloud-recipe-auth
22kHướng dẫn agent của bạn qua quản lý danh tính và quyền truy cập của Google Cloud, gồm cách con người và dịch vụ đăng nhập và những quyền họ nhận được.
google-cloud-recipe-onboarding
22kHướng dẫn một lập trình viên mới qua các bước đầu tiên trên Google Cloud, gồm chọn dự án, liên kết thanh toán và triển khai tài nguyên đầu tiên.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.