Skip to content

gen_ai.choice log reports gen_ai.system=gemini for OpenAI and Groq models through LiteLlm #7631

Closed

Description

@ishan-1010

🔴 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:

  1. pip install google-adk litellm
  2. 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

Activity

  1. added
    models[Component] This issue is related to model support
    on Oct 22, 2026
  2. added 4 commits that reference this issue on Oct 22, 2026
    f713426
    a01db1f
    fbdb2ec
    9844115
  3. added
    tracing[Component] This issue is related to OpenTelemetry tracing
    and removed
    models[Component] This issue is related to model support
    on Oct 26, 2026
  4. llalitkumarrr commented on Oct 26, 2026

    @llalitkumarrr
    Collaborator

    Hello @ishan-1010,

    Thank you for raising this issue and for your input on #7640. We have tested this PR and it should resolve the problem. A detailed review is still pending. If the changes are approved by reviewer, it can be merge.

  5. added a commit that references this issue on Oct 26, 2026
    960cd5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tracing[Component] This issue is related to OpenTelemetry tracing

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions