gen_ai.choice log reports gen_ai.system=gemini for OpenAI and Groq models through LiteLlm
维护者通常 4 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- backend, observability
调研方向
从 src/google/adk/telemetry/tracing.py 开始,重点查看 _inference_system_name、_resolve_gen_ai_system_name 以及 issue 中链接的两个 gen_ai.choice 调用位置。比较 LiteLLM 返回不带提供商前缀的 model_version 时,span 和 choice 日志如何确定 gen_ai.system;使用 mock_response 复现并检查 OpenAI 和 Groq。完成标准是 choice 日志报告的提供商与对应 span 相同,并且现有的 Anthropic 用例仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
🔴 Required Information
Describe the Bug:
with ADK_TELEMETRY_SCHEMA_VERSION_OPT_IN=1 the gen_ai.choice log says gen_ai.system=gemini for openai/gpt-4o and groq/llama-3.1-8b-instant through LiteLlm. the span and the system/user message logs for the same call say openai and groq. anthropic comes out fine
_inference_system_name looks at llm_response.model_version first (tracing.py#L1521-L1531). litellm gives that back without the provider prefix (gpt-4o) so _resolve_gen_ai_system_name finds no provider and falls back to gemini (#L1461-L1475). both choice log call sites go through it (#L1364, #L1424)
Steps to Reproduce:
pip install google-adk litellm- run this (no api key needed, it uses litellm's
mock_response)
import asyncio
import os
os.environ["ADK_TELEMETRY_SCHEMA_VERSION_OPT_IN"] = "1"
from opentelemetry import _logs, trace
from opentelemetry.sdk._logs import LoggerProvider
from opentelemetry.sdk._logs.export import InMemoryLogRecordExporter, SimpleLogRecordProcessor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
spans, logs = InMemorySpanExporter(), InMemoryLogRecordExporter()
tp = TracerProvider()
tp.add_span_processor(SimpleSpanProcessor(spans))
trace.set_tracer_provider(tp)
lp = LoggerProvider()
lp.add_log_record_processor(SimpleLogRecordProcessor(logs))
_logs.set_logger_provider(lp)
from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm
from google.adk.runners import InMemoryRunner
from google.genai import types
async def run(model_id):
spans.clear()
logs.clear()
model = LiteLlm(model=model_id, mock_response="hi", api_key="unused")
runner = InMemoryRunner(agent=Agent(name="a", model=model), app_name="p")
session = await runner.session_service.create_session(app_name="p", user_id="u")
msg = types.Content(role="user", parts=[types.Part(text="hello")])
async for _ in runner.run_async(user_id="u", session_id=session.id, new_message=msg):
pass
await runner.close()
span = next(s for s in spans.get_finished_spans() if s.name.startswith("generate_content"))
print(model_id)
print(" span gen_ai.system:", span.attributes.get("gen_ai.system"))
for r in logs.get_finished_logs():
rec = r.log_record
print(" ", rec.event_name, "gen_ai.system:", rec.attributes.get("gen_ai.system"))
for m in ("openai/gpt-4o", "groq/llama-3.1-8b-instant", "anthropic/claude-sonnet-4-5"):
asyncio.run(run(m))
Expected Behavior:
gen_ai.choice has the same gen_ai.system as the span, so openai and groq here
Observed Behavior:
openai/gpt-4o
span gen_ai.system: openai
gen_ai.system.message gen_ai.system: openai
gen_ai.user.message gen_ai.system: openai
gen_ai.choice gen_ai.system: gemini
groq/llama-3.1-8b-instant
span gen_ai.system: groq
gen_ai.system.message gen_ai.system: groq
gen_ai.user.message gen_ai.system: groq
gen_ai.choice gen_ai.system: gemini
anthropic/claude-sonnet-4-5
span gen_ai.system: anthropic
gen_ai.system.message gen_ai.system: anthropic
gen_ai.user.message gen_ai.system: anthropic
gen_ai.choice gen_ai.system: anthropic
Environment Details:
- ADK Library Version (pip show google-adk): 2.12.0 (main at 77a74f0)
- Desktop OS: macOS
- Python Version (python -V): 3.12.15
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: openai/gpt-4o and groq/llama-3.1-8b-instant via litellm
mock_response
🟡 Optional Information
Regression:
havent checked older versions
falling back to the configured model id (what the span uses) when model_version has no provider prefix would fix it i think. can send a PR
- 主要语言
- Python
- 星标
- 22k
- 派生
- 4.2k
- 平均合并
- 3 天 21 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-python 的其他 Issue
-
InMemoryMemoryService loses sessionless memories when a session ID equals its fallback bucket name可能已有人在做 @llalitkumarrr 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
google/adk-python#7711 · 1 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messages可能已有人在做 @surajksharma07 于 3 天前认领。 未关闭models
难度 2/5 1-3 小时 新手友好度 78/100
google/adk-python#7630 · 11 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
Update opentelemetry-api and opentelemetry-sdk to 1.44.0可能已有人在做 @llalitkumarrr 于 17 天前认领。 未关闭request clarification tracing
难度 2/5 1-3 小时 新手友好度 70/100
google/adk-python#7433 · 5 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cache可能已有人在做 @DeanChensj 于 19 天前认领。 未关闭needs review
难度 2/5 1-3 小时 新手友好度 72/100
google/adk-python#7409 · 1 条评论 · 已指派 2 人 ·
维护者通常 4 天内回复
-
A2aAgentExecutor sends the raw exception text to the A2A caller when the run fails可能已有人在做 @sanketpatil06 于 20 天前认领。 未关闭a2a request clarification
难度 2/5 1-3 小时 新手友好度 84/100
google/adk-python#7385 · 2 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
查看 google/adk-python 的全部 Issue
相似的 Issue
-
The changelog workflow excludes otelbot but not dependabot, so every Dependabot pull request fails the changelog check可能已有人在做 @ocelotl 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
open-telemetry/opentelemetry-python#5825 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
cuga-project/cuga-agent#1020 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
microsoft/playwright#43640 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
stac-utils/stac-fastapi-elasticsearch-opensearch#965 ·
维护者通常 2 天内回复
-
from-review-extraction library privacy python severity:suggested
难度 2/5 1-3 小时 新手友好度 83/100
LearningCircuit/local-deep-research#7951 ·
维护者通常 2 天内回复