본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)22k · #10249

cloud-trace-querying

하는 일

이 스킬은 Google Cloud의 요청 추적 데이터에서 느리거나 잘못된 호출을 찾습니다. 요청의 어느 단계가 문제를 일으키는지 보고 싶은 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Google Cloud 서비스의 요청이 느려서 어느 단계가 원인인지 봐야 할 때.
  • ✓지연 시간 기준이나 오류 상태로 추적을 걸러 보고 싶을 때.
  • ✓분산 추적을 Cloud Logging 항목과 맞춰 봐야 할 때.

스킬 링크

https://github.com/google/skills/blob/main/skills/cloud/cloud-trace-querying/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/cloud-trace-querying/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“지난 1시간 동안 checkout 서비스로 들어온 요청 중 2초가 넘게 걸린 것을 찾고, 어느 단계가 느린지 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

포함된 도구를 실행해 Cloud Trace를 조회하고, 추적 계층 구조를 가져와 정확한 결과를 보고합니다. 그 결과로 가장 많은 시간이 걸리는 단계를 짚어 줍니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

  1. Google Cloud SDK: Verify gcloud is installed (Installation Guide).
  2. Authentication: Authenticate CLI and application default credentials:
    gcloud auth login && gcloud auth application-default login
    
  3. Project & Billing: Identify the target <PROJECT_ID> (from the user's prompt or via bash 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>
    
  4. 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

자주 묻는 질문

다른 벤더의 추적 데이터와도 작동하나요?

아닙니다. Google Cloud의 Cloud Trace만 다룹니다.

어떤 설정이 필요한가요?

Google Cloud SDK와 CLI 로그인, 애플리케이션 기본 자격 증명(application default credentials) 설정, 활성화된 결제 계정이 필요합니다.

데이터베이스 쿼리를 최적화할 수 있나요?

아닙니다. Cloud Trace 밖의 데이터베이스 쿼리 최적화는 범위를 벗어납니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
22k
순위
#10249
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬