Repository navigation
Conversation
opikalova
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-5-5). It may contain mistakes.
Verdict: request_changes — LangChain exports framework defaults and inherited metadata as user display names. Removed wire attributes have no changelog entry.
Addressed before this review
- The PR removed
splunk_ao.system,splunk_ao.llm.time_to_first_token_nsand the normalization switch without a changelog entry. Not addressed: HEAD is still 93e32f6, andCHANGELOG.mdhas noRemovedentry. Raised again in this review. - LangChain exported unnamed runnable defaults (
RunnableSequence,RunnableParallel<...>, lambda function names,LangGraph) assplunk_ao.span.name. Not addressed: HEAD is still 93e32f6. Confirmed again and raised in this review.
General Comments
- 🟠 major (documentation): This PR removes wire attributes and a config switch.
CHANGELOG.mddoes not record any of them. This concern was raised in an earlier unposted round against this same commit, and it is still open.
Removed items:
splunk_ao.system = "splunk_ao_python". The oldnormalize_attributes_for_exportset it before theif not enabledcheck, so every export carried it by default. This includes caller-owned OTel such as A2A. The updated assertions intests/test_otel_native_paths.py:307andsplunk-ao-a2a/tests/test_splunk_ao_compatibility.py:79confirm the change.splunk_ao.llm.time_to_first_token_ns.set_llm_attributesalways emitted it.src/splunk_ao/converter/attribute_mapping.py:355now emits only the seconds value.- The
SPLUNK_AO_DEV_ENABLE_ATTRIBUTE_NORMALIZATIONswitch.tests/test_span_transform.py:128shows it now has no effect.
The description says only "duplicate splunk_ao.* aliases for standard GenAI attributes" are removed. splunk_ao.system is an SDK marker, not an alias. The nanosecond TTFT value was emitted without normalization.
Please answer these questions:
- Does any backend, dashboard or detector read
splunk_ao.systemto find SDK spans? - Does any consumer read the integer nanosecond TTFT value?
If nothing reads them, add a ### Removed entry to CHANGELOG.md for both attributes and the switch. AGENTS.md requires a changelog update when public behaviour changes. If something reads them, keep them.
- 🟡 minor (question): The description says names from "supported native handlers" are exported. The ADK integration is not wired.
splunk-ao-adk/src/splunk_ao_adk/span_manager.py:42-200 calls start_node without _otel_display_name. So ADK agent spans never get splunk_ao.span.name, although LlmAgent(name=...) is user-supplied. ADK names such as agent_run [{name}] are formatted, so they need a separate raw-name source.
Is ADK out of scope for SAO-17270? If yes, state that in the description and the changelog entry. If no, pass the raw agent name as _otel_display_name in span_manager.py.
Follow-ups
Suggested follow-up work that could be tracked as Jira tickets:
src/splunk_ao/handlers/langchain/middleware.py:266-290:wrap_tool_callandawrap_tool_callreadrequest.tool_call["name"]a second time after_prepare_tool_call_paramsalready reads it. Return the raw name from_prepare_tool_call_paramsinstead. Then one place handles a missing or non-dicttool_call.
Skills and MCP tools used
- Skills: none
- MCP tools: none
| callback_name = kwargs.get("name") | ||
| class_reference = options.get("id") | ||
| if isinstance(class_reference, list) and class_reference and callback_name == class_reference[-1]: | ||
| callback_name = None | ||
| if node_type == "tool" and not callback_name: | ||
| callback_name = options.get("name") | ||
| return callback_name if isinstance(callback_name, str) else None |
There was a problem hiding this comment.
🟠 major (bug): Unnamed LangChain runnables export framework defaults as user display names. An earlier unposted round raised this against this commit, and it is still present.
langchain-core always passes name=config.get("run_name") or self.get_name() to on_chain_start. Composite runnables pass serialized=None (langchain_core/runnables/base.py:3426-3428). With no id, the check on line 78 never clears the name.
I ran ChatPromptTemplate | RunnableLambda(f) | RunnableParallel(a=...) with no run_name through this helper. The results were:
RunnableSequence->"RunnableSequence"f->"f"RunnableParallel<a>->"RunnableParallel<a>"- inner
RunnableLambda->"RunnableLambda" ChatPromptTemplate->None(correct)
An uncompiled LangGraph root has the default name "LangGraph" and behaves the same way. As a result, almost every LCEL or LangGraph trace gets a splunk_ao.span.name that the user did not supply. The f case also conflicts with @log, which treats func.__name__ as not explicit (src/splunk_ao/decorator.py:632-634).
Possible fixes:
- Drop the chain name when
serializedis None. This is simple, but it loses realrun_namevalues on composite runnables. - Also reject generated forms: names that start with
Runnable, and"LangGraph". This is more precise, but it is a heuristic list. - Use only sources that are explicit by construction: a root
run_namedetected at the call site,metadata["langgraph_node"], and the toolserialized["name"].
Add a chain-callback regression test that passes the name kwarg the way langchain-core does.
🤖 Generated by the Astra agent
| metadata = kwargs.get("metadata") | ||
| configured_name = metadata.get("name") if isinstance(metadata, dict) else None | ||
| if isinstance(configured_name, str) and configured_name.strip(): | ||
| return configured_name |
There was a problem hiding this comment.
🟠 major (bug): metadata["name"] is inherited by every descendant run, so one root name becomes the display name of every span in the tree.
LangChain merges parent config["metadata"] into each child config. I ran prompt | RunnableLambda(...) | search_tool with config={"metadata": {"name": "Checkout"}}. The helper returned "Checkout" for RunnableSequence, ChatPromptTemplate, RunnableLambda, and the search tool. LLM and retriever callbacks get the same inherited metadata.
Because metadata wins over every other source on line 74, explicit tool names are also hidden.
Fix options:
- Use
metadata["name"]only for a run with noparent_run_id. Passparent_run_idinto_get_display_namefrom each callback. - Use it only when it differs from the parent node's inherited value.
Add a test with a nested run and inherited metadata.
🤖 Generated by the Astra agent
| assert child.parent == root.context | ||
| assert child.name == "execute_tool search" | ||
| assert child.attributes["splunk_ao.span.name"] == "search" | ||
| assert "splunk_ao.span.name" not in root.attributes |
There was a problem hiding this comment.
🟡 minor (testing): This test calls on_chain_start without the name kwarg. Real langchain-core always passes name=run_name or get_name(). So the assertion passes here but fails for every real unnamed RunnableSequence root.
Other new paths have no display-name test. I searched tests/ for splunk_ao.span.name and _otel_display_name. Only test_langchain.py, test_logger_otel_egress.py, test_openai.py and test_span_transform.py match. These paths have no coverage:
- LangChain chain, LLM, chat and retriever callbacks, sync and async
SplunkAOMiddleware.wrap_tool_callandawrap_tool_call- CrewAI crew, agent, task and tool events
- OpenAI Agents owned root and incremental spans
add_agent_spanandadd_control_span
Add tests that pass framework kwargs in the shape the framework really sends. Cover both named and unnamed cases.
🤖 Generated by the Astra agent
Export explicit names supplied through Logger, @log, and supported native handlers as splunk_ao.span.name. Preserve the original OTLP span name and GenAI operation attributes. This PR also removes the opt-in normalization mode and its duplicate splunk_ao.* aliases for standard GenAI attributes.
Design document · SAO-17270