[bot] Spring AI tool/function execution produces no span — only the surrounding chat model call is traced
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- java
- Lĩnh vực
- ai, observability
Hướng nghiên cứu
Bắt đầu với BraintrustSpringAI.java và các tệp auto/*InstrumentationModule.java tương ứng trong cả springai_1_0_0 và springai_2_0_0, sau đó so sánh với TracingToolExecutor của langchain_1_8_0. Theo dõi đường dẫn thực thi của ToolCallingManager và ToolCallback của Spring AI. Được xem là hoàn tất khi mỗi lần gọi công cụ cục bộ có một span riêng trong cả hai module được hỗ trợ, bên cạnh các span gọi model hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Both Spring AI instrumentation modules (springai_1_0_0, springai_2_0_0) only wrap OpenAiChatModel.Builder/AnthropicChatModel.Builder construction (BraintrustSpringAI.wrap()). Spring AI's own local tool-execution machinery — ToolCallingManager/DefaultToolCallingManager, the auto-registered ToolCallingAdvisor, and ToolCallback/MethodToolCallback/FunctionToolCallback — is never touched by either module. When a model response triggers a tool call, Spring AI resolves and invokes the corresponding Java method in-process, but that invocation produces no span: only the LLM call that requested the tool and the follow-up LLM call that consumes the result are traced, with the actual tool execution invisible in between.
This is distinct from the already-filed streaming-reassembly bugs (#78 Anthropic SSE tool_use/thinking blocks, #79 OpenAI SSE tool_calls delta-merging) — those are about the LLM span's own tool_calls output being malformed during streaming. This gap is about the absence of a separate span for the tool's actual execution, which is the "tool-calling during model execution" surface itself, comparable to langchain_1_8_0's TracingToolExecutor which does instrument LangChain4j's equivalent local tool execution.
What is missing
A full-repo search for ToolCalling, ToolCallback, and toolCall under both springai_1_0_0 and springai_2_0_0 returns zero matches. BraintrustSpringAI.java in both modules exposes exactly one entry point:
public static <T> T wrap(OpenTelemetry openTelemetry, T chatModelBuilder) { ... }
which only instruments chat model construction. Neither module registers any instrumentation for:
ToolCallingManager.executeToolCalls()— the method that actually resolves and invokes tool callbacks in response to a model's tool-call requestToolCallingAdvisor— theChatClientadvisor auto-registered whenever tools are present, which drives the resolve/execute loopToolCallback.call()(and itsMethodToolCallback/FunctionToolCallbackimplementations) — the actual per-tool invocation point
For comparison, langchain_1_8_0 instruments LangChain4j's analogous local-execution surface via TracingToolExecutor, producing a dedicated span per tool call — Spring AI has no equivalent.
Braintrust docs status
- Spring AI integration is not documented on Braintrust's integrations page at https://www.braintrust.dev/docs/integrations/ai-providers: not_found
- Braintrust's general tracing docs (https://www.braintrust.dev/docs/instrument/trace-llm-calls) describe function/tool calling as part of LLM span capture, not as a separately-spanned execution step: not_found for a documented tool-execution span pattern this gap would need to follow
Upstream sources
- Spring AI tool calling reference: https://docs.spring.io/spring-ai/reference/api/tools.html — documents
ToolCallingManager,ToolCallingAdvisor(auto-registered in theChatClientadvisor chain), andToolCallback/MethodToolCallback/FunctionToolCallbackas the current (Spring AI 1.x/2.x) tool-execution architecture - Spring AI OpenAI chat reference: https://docs.spring.io/spring-ai/reference/api/chat/openai-chat.html — confirms function/tool calling support for the exact provider this repo already instruments
Local files inspected
braintrust-sdk/instrumentation/springai_1_0_0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/BraintrustSpringAI.java— singlewrap(OpenTelemetry, T chatModelBuilder)entry point (line 61); no tool-calling instrumentationbraintrust-sdk/instrumentation/springai_1_0_0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/auto/SpringAIOpenAIInstrumentationModule.javaandSpringAIAnthropicInstrumentationModule.java— only instrument the two chat model buildersbraintrust-sdk/instrumentation/springai_2_0_0/src/main/java/dev/braintrust/instrumentation/springai/v2_0_0/BraintrustSpringAI.java,SpringAIOpenAI.java,SpringAIAnthropic.java, and theirauto/*InstrumentationModule.java— same scope as 1.0.0, no tool-calling instrumentation- Full-repo grep for
ToolCalling,ToolCallback,toolCallscoped to both Spring AI modules — zero matches braintrust-sdk/instrumentation/langchain_1_8_0/— confirmed as the comparison point: this module does instrument LangChain4j's equivalent local tool-execution surface (TracingToolExecutor)
- Ngôn ngữ chính
- Java
- Star
- 21
- Fork
- 5
- Merge trung bình
- 2 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 8
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của braintrustdata/braintrust-sdk-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Tất cả issue của braintrustdata/braintrust-sdk-java
Issue tương tự
-
certification
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Đang mởbug ecr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Needs: Triage Type: Feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
github/copilot-sdk#2760 ·