adk-observability-guide by google/adk-docs
npx skills add https://github.com/google/adk-docs --skill adk-observability-guide脚手架项目? Cloud Trace 和提示-响应日志记录已通过 Terraform 预配置。有关基础设施详情、环境变量和验证命令,请参阅
references/cloud-trace-and-logging.md。没有脚手架? 请按照以下 ADK 文档链接进行手动设置。对于生产环境基础设施,请使用
/adk-scaffold进行脚手架搭建。
| 文件 | 内容 |
|---|---|
references/cloud-trace-and-logging.md | 脚手架项目详情 — Terraform 预置的资源、环境变量、验证命令、本地启用/禁用 |
references/bigquery-agent-analytics.md | BQ Agent Analytics 插件 — 启用、关键特性、GCS 卸载、工具溯源 |
根据您的需求选择合适的可观测性层级:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 层级 | 功能 | 范围 | 默认状态 | 最佳适用场景 |
|---|---|---|---|---|
| Cloud Trace | 分布式追踪 — 通过 OpenTelemetry span 追踪执行流程、延迟、错误 | 所有模板,所有环境 | 始终启用 | 调试延迟、理解智能体执行流程 |
| 提示-响应日志记录 | 将 GenAI 交互导出到 GCS、BigQuery 和 Cloud Logging | 仅限 ADK 智能体 | 本地禁用,部署时启用 | 审计 LLM 交互、合规性 |
| BigQuery Agent Analytics | 将结构化智能体事件(LLM 调用、工具使用、结果)发送到 BigQuery | 启用插件的 ADK 智能体 | 可选启用(脚手架搭建时使用 --bq-analytics) | 对话分析、自定义仪表板、LLM-as-judge 评估 |
| 第三方集成 | 外部可观测性平台(AgentOps、Phoenix、MLflow 等) | 任何 ADK 智能体 | 可选启用,按提供商设置 | 团队协作、专业可视化、提示管理 |
询问用户 他们需要哪个(些)层级 — 这些层级可以组合使用。Cloud Trace 始终开启;其他层级是附加的。
ADK 使用 OpenTelemetry 发出分布式追踪。每次智能体调用都会产生追踪完整执行流程的 span。
invocation
└── agent_run (每个链中的智能体一个)
├── call_llm (模型请求/响应)
└── execute_tool (工具执行)
| 部署方式 | 设置 |
|---|---|
| Agent Engine | 自动 — 追踪默认导出到 Cloud Trace |
| Cloud Run(脚手架) | 自动 — FastAPI 应用中的 otel_to_cloud=True |
| GKE(脚手架) | 自动 — FastAPI 应用中的 otel_to_cloud=True |
| Cloud Run / GKE(手动) | 在您的应用中配置 OpenTelemetry 导出器 |
| 本地开发 | 与 make playground 配合使用;追踪在 Cloud Console 中可见 |
查看追踪:Cloud Console → Trace → Trace explorer
有关详细设置说明(Agent Engine CLI/SDK、Cloud Run、自定义部署),请获取 https://google.github.io/adk-docs/integrations/cloud-trace/index.md。
捕获 GenAI 交互(模型名称、令牌、时间)并导出到 GCS(JSONL)、BigQuery(外部表)和 Cloud Logging(专用存储桶)。默认保护隐私 — 除非明确配置,否则仅记录元数据。
关键环境变量:OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT — 设置为 NO_CONTENT(仅元数据,部署环境中的默认值)、true(完整内容)或 false(禁用)。除非设置了 LOGS_BUCKET_NAME,否则本地日志记录是禁用的。
有关脚手架项目详情(Terraform 资源、环境变量、隐私模式、启用/禁用、验证命令),请参阅 references/cloud-trace-and-logging.md。
有关 ADK 日志记录文档(日志级别、配置、调试),请获取 https://google.github.io/adk-docs/observability/logging/index.md。
将结构化智能体事件记录到 BigQuery 的可选插件。在脚手架搭建时使用 --bq-analytics 启用。详情请参阅 references/bigquery-agent-analytics.md。
ADK 支持多个第三方可观测性平台。每个平台都使用 OpenTelemetry 或自定义检测来捕获智能体行为。
| 平台 | 关键区别 | 设置复杂度 | 自托管选项 |
|---|---|---|---|
| AgentOps | 会话回放、2 行设置、替代原生遥测 | 极低 | 否(SaaS) |
| Arize AX | 商业平台、生产监控、评估仪表板 | 低 | 否(SaaS) |
| Phoenix | 开源、自定义评估器、实验测试 | 低 | 是 |
| MLflow | 将 OTel 追踪发送到 MLflow Tracking Server、span 树可视化 | 中(需要 SQL 后端) | 是 |
| Monocle | 1 次调用设置、VS Code 甘特图可视化器 | 极低 | 是(本地文件) |
| Weave | W&B 平台、团队协作、时间线视图 | 低 | 否(SaaS) |
| Freeplay | 提示管理 + 评估 + 可观测性一体化平台 | 低 | 否(SaaS) |
询问用户 他们偏好哪个平台 — 展示权衡点并让他们选择。有关设置详情,请从下面的深度探索表中获取相关的 ADK 文档页面。
| 问题 | 解决方案 |
|---|---|
| Cloud Trace 中没有追踪 | 验证 FastAPI 应用中的 otel_to_cloud=True;检查服务帐户是否具有 cloudtrace.agent 角色 |
| 提示-响应数据未出现 | 检查 LOGS_BUCKET_NAME 是否已设置;验证 SA 在存储桶上具有 storage.objectCreator 权限;检查应用日志中是否有遥测设置警告 |
| 隐私模式配置错误 | 检查 OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT 的值 — 使用 NO_CONTENT 表示仅元数据,false 表示禁用 |
| BigQuery Analytics 未记录 | 验证插件是否在 app/agent.py 中配置;检查 BQ_ANALYTICS_DATASET_ID 环境变量是否已设置 |
| 第三方集成未捕获 span | 检查特定于提供商的环境变量(API 密钥、端点);某些提供商(如 AgentOps)会替代原生遥测 |
| 追踪中缺少工具 span | 工具执行 span 出现在 execute_tool 下 — 检查追踪浏览器过滤器 |
| 遥测成本过高 | 切换到 NO_CONTENT 模式;减少 BigQuery 保留期;禁用未使用的层级 |
有关本技能未涵盖的详细文档,请获取以下页面:
| 主题 | URL |
|---|---|
| 可观测性概述 | https://google.github.io/adk-docs/observability/index.md |
| 智能体活动日志记录 | https://google.github.io/adk-docs/observability/logging/index.md |
| Cloud Trace 集成 | https://google.github.io/adk-docs/integrations/cloud-trace/index.md |
| BigQuery Agent Analytics | https://google.github.io/adk-docs/integrations/bigquery-agent-analytics/index.md |
| AgentOps | https://google.github.io/adk-docs/integrations/agentops/index.md |
| Arize AX | https://google.github.io/adk-docs/integrations/arize-ax/index.md |
| Phoenix (Arize) | https://google.github.io/adk-docs/integrations/phoenix/index.md |
| MLflow 追踪 | https://google.github.io/adk-docs/integrations/mlflow/index.md |
| Monocle | https://google.github.io/adk-docs/integrations/monocle/index.md |
| W&B Weave | https://google.github.io/adk-docs/integrations/weave/index.md |
| Freeplay | https://google.github.io/adk-docs/integrations/freeplay/index.md |
每周安装量
1.1K
仓库
GitHub Stars
1.2K
首次出现
2026年3月9日
安全审计
安装于
codex1.1K
cursor1.1K
gemini-cli1.1K
opencode1.1K
github-copilot1.1K
kimi-cli1.1K
Scaffolded project? Cloud Trace and prompt-response logging are pre-configured by Terraform. See
references/cloud-trace-and-logging.mdfor infrastructure details, env vars, and verification commands.No scaffold? Follow the ADK docs links below for manual setup. For production infrastructure, scaffold with
/adk-scaffold.
| File | Contents |
|---|---|
references/cloud-trace-and-logging.md | Scaffolded project details — Terraform-provisioned resources, environment variables, verification commands, enabling/disabling locally |
references/bigquery-agent-analytics.md | BQ Agent Analytics plugin — enabling, key features, GCS offloading, tool provenance |
Choose the right level of observability based on your needs:
| Tier | What It Does | Scope | Default State | Best For |
|---|---|---|---|---|
| Cloud Trace | Distributed tracing — execution flow, latency, errors via OpenTelemetry spans | All templates, all environments | Always enabled | Debugging latency, understanding agent execution flow |
| Prompt-Response Logging | GenAI interactions exported to GCS, BigQuery, and Cloud Logging | ADK agents only | Disabled locally, enabled when deployed | Auditing LLM interactions, compliance |
| BigQuery Agent Analytics | Structured agent events (LLM calls, tool use, outcomes) to BigQuery | ADK agents with plugin enabled | Opt-in (--bq-analytics at scaffold time) | Conversational analytics, custom dashboards, LLM-as-judge evals |
| Third-Party Integrations | External observability platforms (AgentOps, Phoenix, MLflow, etc.) |
Ask the user which tier(s) they need — they can be combined. Cloud Trace is always on; the others are additive.
ADK uses OpenTelemetry to emit distributed traces. Every agent invocation produces spans that track the full execution flow.
invocation
└── agent_run (one per agent in the chain)
├── call_llm (model request/response)
└── execute_tool (tool execution)
| Deployment | Setup |
|---|---|
| Agent Engine | Automatic — traces are exported to Cloud Trace by default |
| Cloud Run (scaffolded) | Automatic — otel_to_cloud=True in the FastAPI app |
| GKE (scaffolded) | Automatic — otel_to_cloud=True in the FastAPI app |
| Cloud Run / GKE (manual) | Configure OpenTelemetry exporter in your app |
| Local dev | Works with make playground; traces visible in Cloud Console |
View traces: Cloud Console → Trace → Trace explorer
For detailed setup instructions (Agent Engine CLI/SDK, Cloud Run, custom deployments), fetch https://google.github.io/adk-docs/integrations/cloud-trace/index.md.
Captures GenAI interactions (model name, tokens, timing) and exports to GCS (JSONL), BigQuery (external tables), and Cloud Logging (dedicated bucket). Privacy-preserving by default — only metadata is logged unless explicitly configured otherwise.
Key env var: OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT — set to NO_CONTENT (metadata only, default in deployed envs), true (full content), or false (disabled). Logging is disabled locally unless LOGS_BUCKET_NAME is set.
For scaffolded project details (Terraform resources, env vars, privacy modes, enabling/disabling, verification commands), see references/cloud-trace-and-logging.md.
For ADK logging docs (log levels, configuration, debugging), fetch https://google.github.io/adk-docs/observability/logging/index.md.
Optional plugin that logs structured agent events to BigQuery. Enable with --bq-analytics at scaffold time. See references/bigquery-agent-analytics.md for details.
ADK supports several third-party observability platforms. Each uses OpenTelemetry or custom instrumentation to capture agent behavior.
| Platform | Key Differentiator | Setup Complexity | Self-Hosted Option |
|---|---|---|---|
| AgentOps | Session replays, 2-line setup, replaces native telemetry | Minimal | No (SaaS) |
| Arize AX | Commercial platform, production monitoring, evaluation dashboards | Low | No (SaaS) |
| Phoenix | Open-source, custom evaluators, experiment testing | Low | Yes |
| MLflow | OTel traces to MLflow Tracking Server, span tree visualization | Medium (needs SQL backend) | Yes |
| Monocle | 1-call setup, VS Code Gantt chart visualizer | Minimal | Yes (local files) |
| Weave | W&B platform, team collaboration, timeline views |
Ask the user which platform they prefer — present the trade-offs and let them choose. For setup details, fetch the relevant ADK docs page from the Deep Dive table below.
| Issue | Solution |
|---|---|
| No traces in Cloud Trace | Verify otel_to_cloud=True in FastAPI app; check service account has cloudtrace.agent role |
| Prompt-response data not appearing | Check LOGS_BUCKET_NAME is set; verify SA has storage.objectCreator on the bucket; check app logs for telemetry setup warnings |
| Privacy mode misconfigured | Check OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT value — use NO_CONTENT for metadata-only, false to disable |
For detailed documentation beyond what this skill covers, fetch these pages:
| Topic | URL |
|---|---|
| Observability overview | https://google.github.io/adk-docs/observability/index.md |
| Agent activity logging | https://google.github.io/adk-docs/observability/logging/index.md |
| Cloud Trace integration | https://google.github.io/adk-docs/integrations/cloud-trace/index.md |
| BigQuery Agent Analytics | https://google.github.io/adk-docs/integrations/bigquery-agent-analytics/index.md |
| AgentOps | https://google.github.io/adk-docs/integrations/agentops/index.md |
Weekly Installs
1.1K
Repository
GitHub Stars
1.2K
First Seen
Mar 9, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex1.1K
cursor1.1K
gemini-cli1.1K
opencode1.1K
github-copilot1.1K
kimi-cli1.1K
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
98,500 周安装
| Any ADK agent |
| Opt-in, per-provider setup |
| Team collaboration, specialized visualization, prompt management |
| Low |
| No (SaaS) |
| Freeplay | Prompt management + evals + observability in one platform | Low | No (SaaS) |
| BigQuery Analytics not logging | Verify plugin is configured in app/agent.py; check BQ_ANALYTICS_DATASET_ID env var is set |
| Third-party integration not capturing spans | Check provider-specific env vars (API keys, endpoints); some providers (AgentOps) replace native telemetry |
| Traces missing tool spans | Tool execution spans appear under execute_tool — check trace explorer filters |
| High telemetry costs | Switch to NO_CONTENT mode; reduce BigQuery retention; disable unused tiers |
| Arize AX | https://google.github.io/adk-docs/integrations/arize-ax/index.md |
| Phoenix (Arize) | https://google.github.io/adk-docs/integrations/phoenix/index.md |
| MLflow tracing | https://google.github.io/adk-docs/integrations/mlflow/index.md |
| Monocle | https://google.github.io/adk-docs/integrations/monocle/index.md |
| W&B Weave | https://google.github.io/adk-docs/integrations/weave/index.md |
| Freeplay | https://google.github.io/adk-docs/integrations/freeplay/index.md |