LangSmith におけるエンドツーエンド OpenTelemetry サポートの導入
LangSmith が LangChain および LangGraph アプリケーション向けに、SDK を介したネイティブな OpenTelemetry サポートを追加し、LLM アプリケーションの観測性を標準化しました。
キーポイント
エンドツーエンドの OpenTelemetry 統合の実現
LangSmith が従来のバックエンド形式での受け入れから、SDK を介したネイティブな生成・送信までを完結させることで、完全なパイプラインを提供します。
LLM アプリケーション特有の課題への対応
従来のエラー監視を超え、多段階ワークフローや確率的な出力の評価といった LLM 固有の観測性課題に対し、統一されたベンダー中立標準で対処可能になります。
ツールとフォーマットの統合による効率化
複数のツールをまたぐ必要がなくなり、LangChain/LangGraph アプリケーションから LangSmith へのトレース収集・可視化が一元的に行えるようになります。
影響分析・編集コメントを表示
影響分析
この発表は、LLM アプリケーション開発における観測性の標準化に向けた大きな一歩であり、開発者が複数の監視ツールを組み合わせる手間を大幅に削減します。特に LangChain エコシステム内での OpenTelemetry の採用が加速し、分散型 LLM システムの信頼性向上とトラブルシューティング効率の劇的な改善につながると予想されます。
編集コメント
LLM アプリ開発の現場では、従来のサーバー監視とは異なる観測性が求められており、この統合は実務的な課題を解決する重要なステップです。OpenTelemetry の標準化が進む中、LangSmith が SDK レベルでネイティブ対応を果たしたことは、業界全体のデベロッパー体験向上に寄与します。
観測機能は、LLM アプリケーションのデバッグと最適化において不可欠ですが、これまでシステム全体を完全に把握するには複数のツールやフォーマットを扱わなければなりませんでした。 now、LangSmith は LangChain および/または LangGraph をベースに構築されたアプリケーションに対して、完全なエンドツーエンドの OpenTelemetry サポートを提供します。
OpenTelemetry (OTel) 統合により、スタック全体でトレーシングを標準化し、トレーシングデータを LangSmith — エージェントライフサイクル用のテストおよび観測プラットフォーム — や他の観測プラットフォームへ送信することが可能になります。
以前は、LangSmith は OpenTelemetry をバックエンドのトレース取り込みフォーマットとしてのみサポートしていましたが、今回の更新により、LangSmith SDK 内にネイティブな OpenTelemetry サポートを追加することで、その全体像を完成させました。
LLM アプリケーションに OpenTelemetry を?
OpenTelemetry (OTel) は、テレメトリデータの収集、エクスポート、分析の方法を標準化するオープンソースの観測フレームワークです。アプリケーションがより複雑で分散化されるにつれ、OpenTelemetry はパフォーマンスの追跡、システム挙動の理解、および問題のトラブルシューティングに一貫した方法を提供します。
LLM アプリケーションにおいて、観測可能性は独自の課題を提示します。従来のアプリケーション監視はエラーや期待される動作への準拠に焦点を当てていますが、LLM 観測可能性では、単純なエラーレートを超えた複雑な 評価指標 を用いて、多段階ワークフローの理解と、動的で確率的な出力の監視が必要となります。
OpenTelemetry は、異なる言語、フレームワーク、バックエンド間で動作する、計測のための統一されたベンダー中立型標準を提供することで、これらの課題に対処します。
OpenTelemetry パイプラインの仕組み
今回のアップデートにより、LangSmith では LLM アプリケーション向けの完全な OpenTelemetry パイプラインが提供されるようになりました:
- LangChain 計測機能:LangChain または LangGraph アプリケーションから詳細なトレースを自動的に生成
- LangSmith SDK:OpenTelemetry の標準化された形式を用いて、これらのトレースを当社の SDK を経由して変換・転送
- LangSmith プラットフォーム:強力な LLM 固有の観測可能性ダッシュボード上でトレースを取り込み、可視化
このエンドツーエンドの統合により、以下の主要なメリットが実現されます:
- 統一された観測機能:LangChain コンポーネントから基盤となるインフラストラクチャまで、アプリケーションスタック全体を単一の統合ビューで表示可能
- 分散トレーシング:マイクロサービスアーキテクチャ内をリクエストが移動する様を追跡し、コンテキスト伝播により関連するスパン(span)が同じトレースに紐付けられるように保証します。
- 相互運用性:Datadog、Grafana、Jaeger などのプラットフォームを含む OpenTelemetry 標準を通じて、LangSmith を既存の観測ツールやインフラストラクチャと接続できます。
この統合により、最初のプロンプトから最終的なレスポンスまで、LLM アプリケーションの実行パス全体を追跡でき、その過程の各ステップについて詳細な可視性が得られます。
LangSmith における OpenTelemetry の始め方
1. インストール
OpenTelemetry サポート付きの LangSmith パッケージをインストールします:
pip install "langsmith[otel]"
pip install langchain
2. OpenTelemetry 統合の有効化
LANGSMITH_OTEL_ENABLED 環境変数を設定することで、OpenTelemetry 統合を有効にできます:
LANGSMITH_OTEL_ENABLED=true
LANGSMITH_TRACING=true
LANGSMITH_ENDPOINT=https://api.smith.langchain.com
LANGSMITH_API_KEY=<your_langsmith_api_key>
3. トレース機能付きの LangChain アプリケーション作成
以下は、LangChain で OpenTelemetry 統合を使用する方法を示す簡単な例です:
import os
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
LangChain は、LANGSMITH_OTEL_ENABLED 環境変数が設定されているため、自動的に OpenTelemetry を使用してトレースを LangSmith に送信します
チェーンを作成する
prompt = ChatPromptTemplate.from_template("{topic} に関するジョークを教えてください")
model = ChatOpenAI()
chain = prompt | model
チェーンを実行する
result = chain.invoke({"topic": "プログラミング"})
print(result.content)
4. LangSmith でトレースを表示する
アプリケーションが実行されると、LangSmith ダッシュボードに このような形で トレースが表示されます。
パフォーマンスに関する考慮事項
エンドツーエンドの OpenTelemetry サポートは最大限の柔軟性と相互運用性を提供しますが、LangSmith のネイティブなトレーシング形式と比較すると、わずかにオーバーヘッドが大きくなります。
観測性プラットフォームとして LangSmith を専ら使用しているユーザーには、最適なパフォーマンスのためにネイティブなトレーシング形式をまだ推奨しています。これにより、保留中のランを含むリアルタイムのトレーシング、高速なインジェスト速度、SDK からのメモリオーバーヘッドの削減が可能になります。
ネイティブの LangSmith トレース形式は、LLM アプリケーションのために特別に設計されており、いくつかの重要な利点を備えています。この形式は、より汎用的な OpenTelemetry フォーマットと比較して、計算およびメモリの負荷が大幅に軽減されています。また、LLM アプリケーションで特有のデータパターンやボリュームに合わせてカスタマイズされた形式となっています。
今日からお試しください
OpenTelemetry を使用して LangChain や LangGraph のアプリケーションをトレースし始める準備はできましたか?詳細や例については、完全なドキュメントをご覧ください。まだお試しいただいていない場合は、無料で LangSmith をお試しください。
原文を表示
Observability is critical for debugging and optimizing LLM applications — but until now, getting a complete view of your system meant juggling multiple tools and formats. Now, LangSmith offers full end-to-end OpenTelemetry support for applications built on LangChain and/or LangGraph.
With our OpenTelemetry (OTel) integration, you can standardize tracing across your stack and send traces to LangSmith — our testing & observability platform for the agent lifecycle — or other observability platforms.
Previously, LangSmith supported OpenTelemetry as only a backend trace ingestion format. With this update, we’re completing the picture by adding native OpenTelemetry support directly into the LangSmith SDK.
Why OpenTelemetry for LLM applications?
OpenTelemetry (OTel) is an open-source observability framework that standardizes how telemetry data is collected, exported, and analyzed. As applications grow more complex and distributed, OpenTelemetry provides a consistent way to track performance, understand system behavior, and troubleshoot issues.
For LLM applications, observability presents unique challenges. Traditional application monitoring focuses on errors and compliance with expected behaviors — however, LLM observability requires understanding multi-step workflows and monitoring dynamic, stochastic outputs with complex evaluation metrics that go beyond simple error rates.
OpenTelemetry addresses these challenges by providing a unified, vendor-neutral standard for instrumentation that works across different languages, frameworks, and backends.
How our OpenTelemetry Pipeline Works
With this update, LangSmith now offers a complete OpenTelemetry pipeline for LLM applications:
- LangChain instrumentation: Automatically generate detailed traces from your LangChain or LangGraph applications
- LangSmith SDK: Convert and transport these traces through our SDK using OpenTelemetry's standardized format
- LangSmith platform: Ingest and visualize traces in a powerful, LLM-specific observability dashboard
This end-to-end integration unlocks several key benefits:
- Unified observability: View your entire application stack—from LangChain components to underlying infrastructure—in a single, cohesive view
- Distributed tracing: Follow requests as they move through your microservices architecture, with context propagation ensuring that related spans are linked to the same trace
- Interoperability: Connect LangSmith with your existing observability tools and infrastructure through the OpenTelemetry standard, including platforms like Datadog, Grafana, and Jaeger.
With this integration, you can trace the complete execution path of your LLM applications, from the initial prompt to the final response, with detailed visibility into each step along the way.
Getting Started with OpenTelemetry in LangSmith
1. Installation
Install the LangSmith package with OpenTelemetry support:
pip install "langsmith[otel]"
pip install langchain2. Enable the OpenTelemetry integration
You can enable the OpenTelemetry integration by setting the LANGSMITH_OTEL_ENABLED environment variable:
LANGSMITH_OTEL_ENABLED=true
LANGSMITH_TRACING=true
LANGSMITH_ENDPOINT=https://api.smith.langchain.com
LANGSMITH_API_KEY=<your_langsmith_api_key>3. Create a LangChain application with tracing
Here's a simple example showing how to use the OpenTelemetry integration with LangChain:
import os
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
# LangChain will automatically use OpenTelemetry to send traces to LangSmith
# because the LANGSMITH_OTEL_ENABLED environment variable is set
# Create a chain
prompt = ChatPromptTemplate.from_template("Tell me a joke about {topic}")
model = ChatOpenAI()
chain = prompt | model
# Run the chain
result = chain.invoke({"topic": "programming"})
print(result.content)4. View the traces in LangSmith
Once your application runs, you'll see the traces in your LangSmith dashboard like this one.
Performance Considerations
While our end-to-end OpenTelemetry support provides maximum flexibility and interoperability, it comes with slightly higher overhead compared to LangSmith’s native tracing format.
For users that are exclusively using LangSmith as their observability platform, we still recommend our native tracing format for optimal performance. It offers realtime tracing with pending runs, faster ingest speeds, and reduced memory overhead from the sdk.
The native LangSmith tracing format has been specifically designed for LLM applications and offers several key advantages. It features significantly reduced overhead with a lower computational and memory footprint compared to the more general-purpose OpenTelemetry format. Our native format is also custom-tailored for the unique data patterns and volumes found in LLM applications.
Try it today
Ready to get started tracing your LangChain and LangGraph applications with OpenTelemetry? Check out our full documentation for more details and examples — and try out LangSmith for free if you haven't already.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み