open-telemetry / open-telemetry/opentelemetry-python-contrib
Google GenAI instrumentation issues with automatic function calling in the gen AI SDK
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
When automatic function calling is enabled: https://github.com/googleapis/python-genai?tab=readme-ov-file#automatic-python-function-support --- or when an mcp server is passed to tools (https://github.com/googleapis/python-genai?tab=readme-ov-file#model-context-protocol-mcp-support-experimental) -- the gen AI SDK will automatically call functions for the user when the LLM asks for it, and then call the LLM with the result (and this can happen multiple times).
The instrumentation just writes 1 span / log in this case, and we miss any intermediate request/response the gen AI SDK makes, because we just monkey patch the top level call / response to / from the SDK..
Ideally we get 1 span / log for each call to the LLM. Might be hard to monkey patch deep into the gen AI SDK to do that..
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the instrumentation's top-level SDK call and response monkey patches, then review the linked python-genai documentation for automatic function calling and MCP support. Trace how intermediate requests and responses are hidden by the current instrumentation. Done means each LLM call in these flows produces its own span or log.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100