LangChain アプリケーションの監視
Splunk AppDynamics Python エージェントは、LangChain フレームワークを使用して構築された GenAI アプリケーションをモニターするのに役立ちます。Python エージェントでアプリケーションをインストゥルメント化すると、ベクトルストアの次のメトリックがキャプチャされます。
- ベクトルデータベース(pgvector および chroma)へのコールを終了します。
- exit コールでのプロンプトと応答。
- 取得されたドキュメントの数、類似性検索スコア、ベクトルデータベースのエラー
- 1分あたりのコール数
LangChain を使用して Ollama などの LLM をモニターするために、Python エージェントは次のメトリックを記録します。
- トークン
- プロンプト数
- 組み込みクエリ数
前提条件
Python エージェントの /path/to/appdynamics.cfg ファイルで enable-langchain フラグを必ず true に設定してください。[instrumentation] を参照してください。
Python エージェントは、Splunk AppDynamics で次のバージョンの LangChain LLM をサポートします。
| コンポーネント | Version |
|---|---|
langchain | 0.2.11 以前 |
langchain-ollama | 0.2.0 以前 |
langchain-chroma | 0.1.1! |
langchain-postgres | 0.0.12 |
chromadb | 0.5.20 以前 |
pgvector | 0.2.5 |
LangChain Ollama API のモニタリング
Ollama コールをモニターするために、Python エージェントは次のメトリックをレポートします。
- 入力トークン = 0.5$
- 出力トークン
- 最初のトークンメトリックまでの時間(ミリ秒)
- 出力トークンあたりの時間(ミリ秒)
- 平均応答時間(ms)
- プロンプト数
- 組み込みクエリ数
- エラー
トークンメトリックを取得するには、transformers Python ライブラリをインストールしてください。「Transformers」を参照してください。
pip install transformersメトリックパスの例:Agent|Langchain|LLM|llama3.2_latest|Average Response Time (ms))
Create a Custom Dashboard to Monitor Ollama APIs
Monitor LangChain Vectorstores
When you instrument the app with Python Agent, it captures the following for Vectorstores:
- For
langchain_communityandlangchain_{vendor}vectorstores, Python Agent captures the following metrics:- Search Score
- Average Response Time (ms)
- Errors
- Calls
- Vector Insertion Count
- Vector Deletion Count
Note:By default, Splunk AppDynamics SaaS capture the following metrics for
langchain_{vendor}vectorstores:langchain_milvuslangchain_chromalangchain_postgres
However, you can set the
langchain-vectorstores-instrumented-modulesflag to capture the metrics from the specific LangChain vendor in/path/to/appdynamics.cfg. For more information, see [instrumentation]. - Exit calls to vector databases: pgvector and chroma.
To capture PGVector and Chroma vectorstores request and response for in snapshot exit call detail, set the enable-genai-data-capture flag to true in the /path/to/appdynamics.cfg file of the Python Agent. See [instrumentation].