Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BOT ISSUE] LangChain4j EmbeddingModel calls are not instrumented

オープン
#73 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java

調査の方向性

まず BraintrustLangchain.java と LangchainInstrumentationModule.java を読み、既存の chat-model wrapper と builder advice に注目します。embedding モデルと builder をどのようにカバーするべきかを判断する前に、WrappedHttpClient と BraintrustLangchainTest.java を確認します。対応する LangChain4j の embedding 呼び出しが入力/出力のキャプチャと使用量メトリクスを含む Braintrust スパンを生成し、新しいインストゥルメンテーションをテストでカバーできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

The LangChain4j instrumentation wraps OpenAiChatModel, OpenAiStreamingChatModel, and AiServices, but does not instrument any EmbeddingModel implementation. Calls to embeddingModel.embed() or embeddingModel.embedAll() through LangChain4j produce no Braintrust spans, no input/output capture, and no usage metrics.

This is distinct from #60 (which covers missing non-OpenAI chat model providers) and from #71 (which covers Spring AI embedding gaps). LangChain4j's EmbeddingModel is a separate interface from ChatLanguageModel with its own implementations, builders, and HTTP transport.

What is missing

No wrapper methods for EmbeddingModel

BraintrustLangchain.java (lines 22–152) only handles:

  • AiServices<T> wrapping (lines 22–85)
  • OpenAiChatModel wrapping (lines 87–118)
  • OpenAiStreamingChatModel wrapping (lines 120–152)

There is no wrap(OpenTelemetry, EmbeddingModel) method or any reference to embedding models.

No auto-instrumentation for embedding builders

LangchainInstrumentationModule.java (lines 44–145) registers ByteBuddy advice for exactly 3 builder classes:

  • OpenAiChatModel$OpenAiChatModelBuilder
  • OpenAiStreamingChatModel$OpenAiStreamingChatModelBuilder
  • AiServices

No embedding model builder (e.g., OpenAiEmbeddingModel$OpenAiEmbeddingModelBuilder) is targeted.

No fallback to upstream SDK auto-instrumentation

LangChain4j embedding model implementations use LangChain4j's own internal dev.langchain4j.http.client.HttpClient, not the upstream provider SDKs (com.openai:openai-java, etc.). This means the OpenAI auto-instrumentation module (openai_2_8_0) does not intercept embedding calls made through LangChain4j's OpenAiEmbeddingModel.

The WrappedHttpClient class in the LangChain4j module already wraps LangChain4j's internal HTTP client for chat models — the same pattern could be applied to embedding models.

Affected LangChain4j embedding models
LangChain4j class Provider
OpenAiEmbeddingModel OpenAI
AzureOpenAiEmbeddingModel Azure OpenAI
GoogleAiEmbeddingModel Google AI
VertexAiEmbeddingModel Google Vertex AI
OllamaEmbeddingModel Ollama
MistralAiEmbeddingModel Mistral AI

Braintrust docs status

Upstream sources

Local files inspected

  • braintrust-sdk/instrumentation/langchain_1_8_0/src/main/java/dev/braintrust/instrumentation/langchain/v1_8_0/BraintrustLangchain.java — lines 22–152 (only chat model and AiServices wrapping; no embedding model handling)
  • braintrust-sdk/instrumentation/langchain_1_8_0/src/main/java/dev/braintrust/instrumentation/langchain/v1_8_0/auto/LangchainInstrumentationModule.java — lines 44–145 (only chat model builders and AiServices targeted; no embedding builder)
  • braintrust-sdk/instrumentation/langchain_1_8_0/src/main/java/dev/braintrust/instrumentation/langchain/v1_8_0/WrappedHttpClient.java — existing HTTP client wrapper that could be reused for embedding models
  • braintrust-sdk/instrumentation/langchain_1_8_0/src/test/java/dev/braintrust/instrumentation/langchain/v1_8_0/BraintrustLangchainTest.java — no embedding model tests exist
主要言語
Java
スター
21
フォーク
5
平均マージ
2日 7時間
マージ済み PR(30日)
8

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

braintrustdata/braintrust-sdk-java のほかの issue

braintrustdata/braintrust-sdk-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。