Cloud Trace Querying
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The cloud-trace-querying skill enables agents to interact directly with Google Cloud Trace to investigate performance issues. It provides structured workflows to search for traces based on latency or error status, inspect trace hierarchies, and retrieve correlated application logs from Cloud Logging. The skill is designed for diagnosing latency regressions and service bottlenecks within Google Cloud environments by executing specific diagnostic scripts and formatting the results for analysis.
What it does
- Searches for traces using latency thresholds and error filters.
- Fetches full trace hierarchies to visualize span relationships.
- Retrieves application logs correlated with specific trace IDs.
- Inspects individual span attributes and metadata.
- Generates direct Cloud Console deep links for further manual inspection.
- Formats trace data into ASCII timelines or JSON graphs.
When to use it
- When investigating slow requests or latency regressions in GCP services.
- When analyzing trace hierarchies to identify bottlenecks.
- When correlating error logs with specific distributed trace events.
- When troubleshooting service crashes or unexpected error statuses.
Advantages
- Provides standardized diagnostic workflows for GCP observability.
- Enables direct correlation between distributed traces and application logs.
- Supports flexible filtering by latency and error status.
- Automates the generation of deep links for rapid transition to the Cloud Console.
Usage examples
- “Find all traces for /v1/booking/book that took longer than 1.5 seconds.”
- The agent executes the search script with the specified filter and returns a list of matching trace IDs and their durations.
- “Show me the logs related to trace ID 12345.”
- The agent fetches and displays application log entries correlated with the provided trace ID to help identify the root cause of an error.
- “Generate a link to view trace 12345 in the Google Cloud Console.”
- The agent provides a direct URL that opens the specific trace in the Cloud Trace Explorer.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/cloud-trace-querying/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cloud-trace-querying.zip -d .agents/skills
Documentation by Google
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 loginProject & 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.sh2. 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 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
Operational Workflows
Query Syntax & Tools
Filter Syntax (
root:,latency:,+span:,error:true)
Semantic Conventions
Concepts & Architecture
Templates & Assets
Official Documentation Links
Files
- ATTRIBUTION.mdAdded by AutoGineer858 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md7.2 KiB
- assets/formatting/a2ui/single_span/display.a2ui.json1.1 KiB
- assets/formatting/a2ui/trace_chart/display.a2ui.json1.1 KiB
- assets/formatting/a2ui/trace_flow/display.a2ui.json767 B
- assets/formatting/a2ui/traces_heat_map/display.a2ui.json1.8 KiB
- assets/formatting/ascii/single_span/display.txt377 B
- assets/formatting/ascii/trace_chart/display.txt517 B
- assets/formatting/ascii/trace_flow/display.txt430 B
- assets/formatting/ascii/traces_heat_map/display.txt887 B
- assets/queries/billing_errors/SCENARIO.md1.4 KiB
- assets/queries/billing_errors/query.txt73 B
- assets/queries/checkout_latency/SCENARIO.md416 B
- assets/queries/checkout_latency/query.txt47 B
- assets/queries/customer_spans/SCENARIO.md307 B
- assets/queries/customer_spans/query.txt24 B
- assets/queries/prod_outliers/SCENARIO.md979 B
- assets/queries/prod_outliers/query.txt51 B
- assets/queries/slow_db/SCENARIO.md440 B
- assets/queries/slow_db/query.txt35 B
- references/api-limits.md1.6 KiB
- references/attribution.md1.9 KiB
- references/concepts-span.md869 B
- references/concepts-trace.md1.3 KiB
- references/console-deep-links.md1.1 KiB
- references/conventions-gcp-legacy.md3.4 KiB
- references/conventions-gcp.md2.7 KiB
- references/conventions-otel-genai.md6.9 KiB
- references/conventions-otel-grpc.md2.4 KiB
- references/conventions-otel-http.md1.9 KiB
- references/conventions-otel.md4.2 KiB
- references/conventions.md2.5 KiB
- references/correlated-logs.md2.5 KiB
- references/decision-tree.md2.1 KiB
- references/filter-syntax.md4.0 KiB
- references/index.md2.7 KiB
- references/knowledge-overview.md3.2 KiB
- references/logs-trace-correlation.md1.7 KiB
- references/observability-scopes.md3.0 KiB
- references/querying-mcp.md2.0 KiB
- references/querying-observability-analytics.md4.9 KiB
- references/troubleshoot-latency.md2.1 KiB
- references/workflows-overview.md881 B
- scripts/fetch_entire_trace/run.shScript231 B
- scripts/fetch_entire_trace/src/main.pyScript1.8 KiB
- scripts/fetch_entire_trace/test.shScript279 B
- scripts/fetch_entire_trace/tests/main_test.pyScript3.9 KiB
- scripts/fetch_related_logs/run.shScript231 B
- scripts/fetch_related_logs/src/log_fetcher.pyScript7.4 KiB
- scripts/fetch_related_logs/src/main.pyScript2.4 KiB
- scripts/fetch_related_logs/src/observability_scopes.pyScript3.0 KiB
- scripts/fetch_related_logs/src/timestamp_utils.pyScript577 B
- scripts/fetch_related_logs/test.shScript422 B
- scripts/fetch_related_logs/tests/main_test.pyScript10.6 KiB
- scripts/fetch_related_logs/tests/timestamp_utils_test.pyScript1.1 KiB
- scripts/fetch_trace_span/run.shScript231 B
- scripts/fetch_trace_span/src/main.pyScript2.6 KiB
- scripts/fetch_trace_span/test.shScript279 B
- scripts/fetch_trace_span/tests/main_test.pyScript5.1 KiB
- scripts/generate_links/run.shScript138 B
- scripts/generate_links/src/main.pyScript1.7 KiB
- scripts/generate_links/test.shScript279 B
- scripts/generate_links/tests/main_test.pyScript2.7 KiB
- scripts/get_trace_project/run.shScript231 B
- scripts/get_trace_project/src/main.pyScript402 B
- scripts/get_trace_project/src/project_resolver.pyScript2.0 KiB
- scripts/get_trace_project/test.shScript279 B
- scripts/get_trace_project/tests/integration_test.pyScript2.7 KiB
- scripts/get_trace_project/tests/project_resolver_test.pyScript2.8 KiB
- scripts/requirements.txt92 B
- scripts/run_python_with_deps/run.shScript2.0 KiB
- scripts/run_python_with_deps/src/cleanup_env.pyScript2.1 KiB
- scripts/run_python_with_deps/src/lock_manager.pyScript2.5 KiB
- scripts/run_python_with_deps/src/manage_venv.pyScript1.7 KiB
- scripts/run_python_with_deps/src/path_resolver.pyScript3.4 KiB
- scripts/run_python_with_deps/src/venv_cleaner.pyScript800 B
- scripts/run_python_with_deps/src/venv_executor.pyScript1.2 KiB
- scripts/run_python_with_deps/src/venv_setup.pyScript2.1 KiB
- scripts/run_python_with_deps/test.shScript364 B
- scripts/run_python_with_deps/tests/cleanup_env_test.pyScript2.5 KiB
- scripts/run_python_with_deps/tests/lock_manager_test.pyScript2.0 KiB
- scripts/run_python_with_deps/tests/path_resolver_test.pyScript5.4 KiB
- scripts/run_python_with_deps/tests/venv_setup_test.pyScript1.8 KiB
- scripts/search_traces/run.shScript231 B
- scripts/search_traces/src/main.pyScript2.1 KiB
- scripts/search_traces/src/timestamp_utils.pyScript1.5 KiB
- scripts/search_traces/src/trace_searcher.pyScript16.0 KiB
- scripts/search_traces/test.shScript279 B
- scripts/search_traces/tests/main_test.pyScript2.7 KiB
- scripts/search_traces/tests/timestamp_utils_test.pyScript1.7 KiB
- scripts/search_traces/tests/trace_searcher_test.pyScript17.4 KiB
LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool, Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/cloud-trace-querying · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cloud-trace-querying.zip