cloud-trace-querying
google/skills/skills/cloud/cloud-trace-querying/SKILL.md
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.
What's in it
- Cloud Trace Querying Skill (cloud-trace-querying)
- Prerequisites & Setup
- Quickstart Workflows
- 1. Identify Google Cloud Project ID
- 2. Search Traces (Latency & Errors)
- 3. Fetch Entire Trace Hierarchy
- 4. Fetch Correlated Application Logs
- 5. Fetch Specific Trace Span
- 6. Generate Cloud Console Deep Links
- 7. Format Output
- 8. Upstream Service Error Handling
- Reference Documentation
- Operational Workflows
- Query Syntax & Tools
- Semantic Conventions
- Concepts & Architecture
- Templates & Assets
- Official Documentation Links
--- name: cloud-trace-querying metadata: version: "1.0.0" category: CloudObservabilityAndMonitoring description: >- 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. --- # 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. ## Prerequisites & Setup 1. **Google Cloud SDK**: Verify `gcloud` is installed ([Installation Guide](https://docs.cloud.google.com/sdk/docs/install-sdk)). 2. **Authentication**: Authenticate CLI and application default credentials: ```bash 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: ```bash gcloud config set project <PROJECT_ID> ``` 4. **API Enablement**: Verify Cloud Trace and Cloud Logging APIs are enabled: ```bash 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 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 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 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 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 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 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 API returns an upstream HTTP service error (such as `500 Internal Server Error`, `503 Service Unavailable`, or `GoogleAPICallError`), report the upstream service outage directly to the user. Do not attempt to inspect virtual environments, modify internal scripts, or debug local libraries. ## Reference Documentation - **Master Index**: [Reference Documentation Index](./references/index.md) ### Operational Workflows - [Troubleshoot Latency Workflow](./references/troubleshoot-latency.md) - [Correlated Logs Workflow](./references/correlated-logs.md) - [Trace Querying Decision Tree](./references/decision-tree.md) - [Console Deep Links](./references/console-deep-links.md) - [Workflows Overview](./references/workflows-overview.md) ### Query Syntax & Tools - [Filter Syntax](./references/filter-syntax.md) (`root:`, `latency:`, `+span:`, `error:true`) - [API Limits and Constraints](./references/api-limits.md) - [Observability Analytics (BigQuery SQL)](./references/querying-observability-analytics.md) - [Cloud Trace MCP Tools](./references/querying-mcp.md) ### Semantic Conventions - [Conventions Overview](./references/conventions.md) - [OpenTelemetry Core](./references/conventions-otel.md) - [OpenTelemetry HTTP](./references/conventions-otel-http.md) - [OpenTelemetry gRPC & RPC](./references/conventions-otel-grpc.md) - [OpenTelemetry GenAI](./references/conventions-otel-genai.md) - [GCP App Hub & Service Conventions](./references/conventions-gcp.md) - [GCP Legacy Labels](./references/conventions-gcp-legacy.md) ### Concepts & Architecture - [Observability Scopes](./references/observability-scopes.md) - [Distributed Traces Concept](./references/concepts-trace.md) - [Spans Concept](./references/concepts-span.md) - [Logs-to-Trace Correlation](./references/logs-trace-correlation.md) - [Knowledge Overview](./references/knowledge-overview.md) ### Templates & Assets - [ASCII Formatting Templates](./assets/formatting/ascii) - [A2UI Formatting Templates](./assets/formatting/a2ui) - [Query Scenarios](./assets/queries) ## Official Documentation Links - [Cloud Trace Documentation](https://docs.cloud.google.com/trace/docs) - [Finding and Viewing Traces](https://docs.cloud.google.com/trace/docs/finding-traces) - [OpenTelemetry Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/)
More agent context in google/skills
165 other files this repository gives its agents, the first 60 shown.
AGENTS.md
Skill
- finding-google-skillsplugins/cloud/google-cloud-developer/skills/finding-google-skills/SKILL.md
- gcloudplugins/cloud/google-cloud-developer/skills/gcloud/SKILL.md
- google-cloud-recipe-authplugins/cloud/google-cloud-developer/skills/google-cloud-recipe-auth/SKILL.md
- google-cloud-recipe-onboardingplugins/cloud/google-cloud-developer/skills/google-cloud-recipe-onboarding/SKILL.md
- retrieving-developer-knowledgeplugins/cloud/google-cloud-developer/skills/retrieving-developer-knowledge/SKILL.md
- data-manager-api-audience-ingestionskills/ads/data-manager-api-audience-ingestion/SKILL.md
- data-manager-api-event-ingestionskills/ads/data-manager-api-event-ingestion/SKILL.md
- data-manager-api-setupskills/ads/data-manager-api-setup/SKILL.md
- google-ads-api-account-diagnosticsskills/ads/google-ads-api-account-diagnostics/SKILL.md
- google-ads-api-mcp-setupskills/ads/google-ads-api-mcp-setup/SKILL.md
- google-ads-api-quickstartskills/ads/google-ads-api-quickstart/SKILL.md
- google-mobile-ads-android-migrate-to-next-genskills/ads/google-mobile-ads-android-migrate-to-next-gen/SKILL.md
- google-mobile-ads-bannerskills/ads/google-mobile-ads-banner/SKILL.md
- google-mobile-ads-get-startedskills/ads/google-mobile-ads-get-started/SKILL.md
- google-mobile-ads-interstitialskills/ads/google-mobile-ads-interstitial/SKILL.md
- google-mobile-ads-rewardedskills/ads/google-mobile-ads-rewarded/SKILL.md
- google-mobile-ads-validateskills/ads/google-mobile-ads-validate/SKILL.md
- ima-dai-sdkskills/ads/ima-dai-sdk/SKILL.md
- ima-sdk-client-sideskills/ads/ima-sdk-client-side/SKILL.md
- google-analytics-admin-api-basicsskills/analytics/google-analytics-admin-api-basics/SKILL.md
- google-analytics-data-api-basicsskills/analytics/google-analytics-data-api-basics/SKILL.md
- agent-platform-alert-configurationskills/cloud/agent-platform-alert-configuration/SKILL.md
- agent-platform-deployskills/cloud/agent-platform-deploy/SKILL.md
- agent-platform-endpoint-managementskills/cloud/agent-platform-endpoint-management/SKILL.md
- agent-platform-eval-flywheelskills/cloud/agent-platform-eval-flywheel/SKILL.md
- agent-platform-inferenceskills/cloud/agent-platform-inference/SKILL.md
- agent-platform-migrate-from-ai-studioskills/cloud/agent-platform-migrate-from-ai-studio/SKILL.md
- agent-platform-model-registryskills/cloud/agent-platform-model-registry/SKILL.md
- agent-platform-prompt-managementskills/cloud/agent-platform-prompt-management/SKILL.md
- agent-platform-rag-engine-managementskills/cloud/agent-platform-rag-engine-management/SKILL.md
- agent-platform-skill-registryskills/cloud/agent-platform-skill-registry/SKILL.md
- agent-platform-troubleshootingskills/cloud/agent-platform-troubleshooting/SKILL.md
- agent-platform-tuning-managementskills/cloud/agent-platform-tuning-management/SKILL.md
- agent-platform-tuningskills/cloud/agent-platform-tuning/SKILL.md
- alloydb-basicsskills/cloud/alloydb-basics/SKILL.md
- application-design-center-design-deployskills/cloud/application-design-center-design-deploy/SKILL.md
- bigquery-ai-mlskills/cloud/bigquery-ai-ml/SKILL.md
- bigquery-basicsskills/cloud/bigquery-basics/SKILL.md
- bigquery-bigframesskills/cloud/bigquery-bigframes/SKILL.md
- bigquery-observabilityskills/cloud/bigquery-observability/SKILL.md
- bigquery-optimizationskills/cloud/bigquery-optimization/SKILL.md
- bigquery-troubleshootingskills/cloud/bigquery-troubleshooting/SKILL.md
- bigtable-basicsskills/cloud/bigtable-basics/SKILL.md
- cloud-build-basicsskills/cloud/cloud-build-basics/SKILL.md
- cloud-databases-onboardingskills/cloud/cloud-databases-onboarding/SKILL.md
- cloud-logging-configuration-basicsskills/cloud/cloud-logging-configuration-basics/SKILL.md
- cloud-logging-cross-project-configurationskills/cloud/cloud-logging-cross-project-configuration/SKILL.md
- cloud-logging-query-generationskills/cloud/cloud-logging-query-generation/SKILL.md
- cloud-monitoring-chart-generationskills/cloud/cloud-monitoring-chart-generation/SKILL.md
- cloud-monitoring-list-time-series-requestskills/cloud/cloud-monitoring-list-time-series-request/SKILL.md
- cloud-monitoring-metric-selectionskills/cloud/cloud-monitoring-metric-selection/SKILL.md
- cloud-monitoring-promql-queryskills/cloud/cloud-monitoring-promql-query/SKILL.md
- cloud-run-alert-configurationskills/cloud/cloud-run-alert-configuration/SKILL.md
- cloud-run-basicsskills/cloud/cloud-run-basics/SKILL.md
- cloud-sql-basicsskills/cloud/cloud-sql-basics/SKILL.md
Discussion
Talked about elsewhere, linking to google/skills
- Google repository now has 90 skills
Hacker News · 5 points · Aug 6, 2026
- google/skills : dépôt open source de Google avec des dizaines de skills prêts à l'emploi pour agents IA sur GKE, BigQuery, Gemini API et…
Bluesky · @camilleroux.com · 9 likes and reposts · 4 replies · Aug 11, 2026
- [Feature]: Support npx skills add to discover double nested skill directories
GitHub · vercel-labs/skills · 5 reactions · 4 comments · Jun 23, 2026
- Google/skills: Agent Skills for Google products and technologies
Hacker News · 1 points · 1 comments · Jun 9, 2026
- Google公式Skillsリポジトリ
Bluesky · @matsuu.bsky.social · 5 likes and reposts · May 2, 2026
- [Bug]: skills.sh page generates invalid command
GitHub · vercel-labs/skills · 2 reactions · 3 comments · Jun 24, 2026
- Resources: - Vercel Labs Skills CLI: github.com/vercel-labs/... - Google Agent Skills: github.com/google/skills #AIAgents #GeminiAPI…
Bluesky · @kweinmeister.bsky.social · 4 likes and reposts · Jun 27, 2026
- fix(sync-upstream-skills): upstream drift fails the sync instead of dropping the correction
GitHub · gke-labs/kube-agents · 1 reactions · 9 comments · Sep 30, 2026
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

