[BOT ISSUE] LangChain4j instrumentation only supports OpenAI-backed chat models
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- java
调研方向
从 BraintrustLangchain.java 开始,重点查看模型检查和 OpenAI 特定的包装,然后阅读 LangchainInstrumentationModule.java 和 WrappedHttpClient.java。跟踪现有的 OpenAI builder advice 和 HTTP client wrapper 的工作方式。完成的标准是,列出的非 OpenAI LangChain4j provider 在包装和自动插桩路径中都获得等效的 LLM 级 instrumentation。
由索引模型根据 Issue 内容生成。
描述
Summary
The LangChain4j instrumentation only wraps OpenAiChatModel and OpenAiStreamingChatModel. All other LangChain4j model providers — including Anthropic, Google Gemini, Azure OpenAI, and Mistral — are explicitly skipped with a warning, producing no LLM-level span data for those calls.
Unlike the Spring AI integration (where unsupported providers can fall through to direct SDK auto-instrumentation, e.g. the GenAI module intercepts Client$Builder.build()), LangChain4j model providers use their own internal HTTP clients rather than the upstream SDK clients. This means no other auto-instrumentation module catches these calls.
What is missing
BraintrustLangchain.wrap(OpenTelemetry, AiServices) (lines 36-51) performs instanceof checks against only two model classes:
if (chatModel instanceof OpenAiChatModel oaiModel) {
aiServices.chatModel(wrap(openTelemetry, oaiModel));
} else {
log.warn("unsupported model: {}. LLM calls will not be instrumented",
chatModel.getClass().getName());
}
The auto-instrumentation module (LangchainInstrumentationModule) similarly only registers ByteBuddy advice for OpenAiChatModel$OpenAiChatModelBuilder.build() and OpenAiStreamingChatModel$OpenAiStreamingChatModelBuilder.build().
The most impactful missing model providers are:
| LangChain4j model class | Provider |
|---|---|
AnthropicChatModel |
Anthropic Claude |
GoogleAiGeminiChatModel / GoogleAiGeminiStreamingChatModel |
Google Gemini |
VertexAiGeminiChatModel / VertexAiGeminiStreamingChatModel |
Google Vertex AI |
AzureOpenAiChatModel / AzureOpenAiStreamingChatModel |
Azure OpenAI |
MistralAiChatModel / MistralAiStreamingChatModel |
Mistral AI |
Since the existing OpenAI instrumentation works by wrapping LangChain4j's internal HttpClient interface (extracted via reflection from the model's internal client), the same pattern could apply to other providers — each uses the same dev.langchain4j.http.client.HttpClient interface internally.
Braintrust docs status
Braintrust docs do not have a LangChain4j-specific page. The Java SDK is listed as supported for OpenAI, Anthropic, and Gemini providers at https://www.braintrust.dev/docs/integrations/ai-providers, but LangChain4j as a framework integration is not_found in docs.
Upstream sources
- LangChain4j supports 20+ model providers as first-party integrations: https://github.com/langchain4j/langchain4j
- LangChain4j model provider modules:
langchain4j-anthropic,langchain4j-google-ai-gemini,langchain4j-vertex-ai-gemini,langchain4j-azure-open-ai,langchain4j-mistral-ai, etc. - All LangChain4j model providers use their own
dev.langchain4j.http.client.HttpClientinternally (not the upstream provider SDK), so upstream SDK auto-instrumentation does not cover them.
Local files inspected
braintrust-sdk/instrumentation/langchain_1_8_0/src/main/java/dev/braintrust/instrumentation/langchain/v1_8_0/BraintrustLangchain.java— lines 36-51 (instanceofcheck limits to OpenAI only), lines 88-152 (OpenAI-specific wrapping via internal HttpClient)braintrust-sdk/instrumentation/langchain_1_8_0/src/main/java/dev/braintrust/instrumentation/langchain/v1_8_0/auto/LangchainInstrumentationModule.java— lines 55-68, 85-100 (auto-instrumentation only targets OpenAI builders)braintrust-sdk/instrumentation/langchain_1_8_0/src/main/java/dev/braintrust/instrumentation/langchain/v1_8_0/WrappedHttpClient.java— the HTTP client wrapper that could be reused for other providers
- 主要语言
- Java
- 星标
- 21
- 派生
- 5
- 平均合并
- 1 天 20 小时
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
braintrustdata/braintrust-sdk-java 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 68/100
查看 braintrustdata/braintrust-sdk-java 的全部 Issue
相似的 Issue
-
enhancement good first issue
难度 2/5 半天 新手友好度 66/100
apache/fineract-consumer-facing#175 ·
维护者通常 1 天内回复
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)可能已有人在做 @dadiyang 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mix可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
apache/rocketmq-dashboard#6110 ·
维护者通常 4 天内回复
-
Feature:Resolution
难度 2/5 1-3 小时 新手友好度 72/100
intellij-elixir/intellij-elixir#4396 ·
维护者通常 1 天内回复
-
Python 3.15 support可能已有人在做 @amnesiaof 今天认领。 未关闭L: python L: python:uv
难度 2/5 1-3 小时 新手友好度 72/100
dependabot/dependabot-core#16524 · 1 条评论 ·
维护者通常 1 天内回复