可観測性
Spring AI は、Spring エコシステムの可観測性機能に基づいて構築され、AI 関連の操作に関するインサイトを提供します。Spring AI は、そのコアコンポーネントである ChatClient
(Advisor
を含む)、ChatModel
、EmbeddingModel
、ImageModel
、VectorStore
のメトリクスとトレース機能を提供します。
低いカーディナリティキーはメトリクスとトレースに追加されますが、高いカーディナリティキーはトレースにのみ追加されます。 |
チャットクライアント
spring.ai.chat.client
観測は、ChatClient call()
または stream()
操作が呼び出されたときに記録されます。呼び出しの実行に費やされた時間を測定し、関連するトレース情報を伝播します。
名前 | 説明 |
---|---|
| 常に |
| 常に |
| チャットモデルのレスポンスはストリームですか - |
| Spring AI のフレームワーク API の種類: |
名前 | 説明 |
---|---|
| アドバイザーパラメーターのマップ。 |
| 構成されたチャットクライアントアドバイザーのリスト。 |
| チャットクライアントのシステムパラメーター。オプション。 |
| チャットクライアントのシステムテキスト。オプション。 |
| 有効なツール機能名。 |
| 構成されたチャットクライアント関数コールバックのリスト。 |
| チャットクライアントのユーザーパラメーター。オプション。 |
| Chat client user text. Optional. |
Input Data
The ChatClient
input data is typically big and possibly containing sensitive information. For those reasons, it is not exported by default.
Spring AI supports exporting input data as span attributes across all tracing backends.
プロパティ | 説明 | デフォルト |
---|---|---|
| Whether to include the input content in the observations. |
|
If you enable the inclusion of the input content in the observations, there’s a risk of exposing sensitive or private information. Please, be careful! |
Chat Client Advisors
The spring.ai.advisor
observations are recorded when a call or stream around advisors is performed. They measure the time spent in the advisor (including the time spend on the inner advisors) and propagate the related tracing information.
名前 | 説明 |
---|---|
| 常に |
| 常に |
| アドバイザーがリクエスト処理でロジックを適用する場合は、 |
| Spring AI のフレームワーク API の種類: |
名前 | 説明 |
---|---|
| Name of the advisor. |
| Advisor order in the advisor chain. |
Chat Model
Observability features are currently supported only for ChatModel implementations from the following AI model providers: Anthropic, Azure OpenAI, Mistral AI, Ollama, OpenAI, Vertex AI, MiniMax, Moonshot, QianFan, Zhiu AI. Additional AI model providers will be supported in a future release. |
The gen_ai.client.operation
observations are recorded when calling the ChatModel call
or stream
methods. They measure the time spent on method completion and propagate the related tracing information.
The gen_ai.client.token.usage metrics measures number of input and output tokens used by a single model call. |
名前 | 説明 |
---|---|
| 実行される操作の名前。 |
| クライアントインストルメンテーションによって識別されるモデルプロバイダー。 |
| リクエストが行われているモデルの名前。 |
| レスポンスを生成したモデルの名前。 |
名前 | 説明 |
---|---|
| モデルリクエストの頻度ペナルティ設定。 |
| モデルがリクエストに対して生成するトークンの最大数。 |
| モデルリクエストのプレゼンスペナルティ設定。 |
| モデルがそれ以上のトークンの生成を停止するために使用するシーケンスのリスト。 |
| モデルリクエストの温度設定。 |
| モデルリクエストの top_k サンプリング設定。 |
| モデルリクエストの top_p サンプリング設定。 |
| 受信した各世代に対応する、モデルがトークンの生成を停止した理由。 |
| AI レスポンスの一意の識別子。 |
| モデル入力 (プロンプト) で使用されるトークンの数。 |
| モデル出力(完了)で使用されるトークンの数。 |
| The total number of tokens used in the model exchange. |
| The full prompt sent to the model. Optional. |
| The full response received from the model. Optional. |
For measuring user tokens, the previous table lists the values present in an observation trace. Use the metric name gen_ai.client.token.usage that is provided by the ChatModel . |
名前 | 説明 |
---|---|
| Event including the content of the chat prompt. Optional. |
| Event including the content of the chat completion. Optional. |
Chat Prompt and Completion Data
The chat prompt and completion data is typically big and possibly containing sensitive information. For those reasons, it is not exported by default.
Spring AI supports exporting chat prompt and completion data as span events if you use an OpenTelemetry tracing backend, whereas data is exported as span attributes if you use an OpenZipkin tracing backend.
Furthermore, Spring AI supports logging chat prompt and completion data, useful for troubleshooting scenarios.
プロパティ | 説明 | デフォルト |
---|---|---|
| Include the prompt content in observations. |
|
| Include the completion content in observations. |
|
| Include error logging in observations. |
|
If you enable the inclusion of the chat prompt and completion data in the observations, there’s a risk of exposing sensitive or private information. Please, be careful! |
EmbeddingModel
Observability features are currently supported only for EmbeddingModel implementations from the following AI model providers: Azure OpenAI, Mistral AI, Ollama, and OpenAI. Additional AI model providers will be supported in a future release. |
The gen_ai.client.operation
observations are recorded on embedding model method calls. They measure the time spent on method completion and propagate the related tracing information.
The gen_ai.client.token.usage metrics measures number of input and output tokens used by a single model call. |
名前 | 説明 |
---|---|
| 実行される操作の名前。 |
| クライアントインストルメンテーションによって識別されるモデルプロバイダー。 |
| リクエストが行われているモデルの名前。 |
| レスポンスを生成したモデルの名前。 |
名前 | 説明 |
---|---|
| The number of dimensions the resulting output embeddings have. |
| The number of tokens used in the model input. |
| The total number of tokens used in the model exchange. |
For measuring user tokens, the previous table lists the values present in an observation trace. Use the metric name gen_ai.client.token.usage that is provided by the EmbeddingModel . |
イメージモデル
Observability features are currently supported only for ImageModel implementations from the following AI model providers: OpenAI. Additional AI model providers will be supported in a future release. |
The gen_ai.client.operation
observations are recorded on image model method calls. They measure the time spent on method completion and propagate the related tracing information.
The gen_ai.client.token.usage metrics measures number of input and output tokens used by a single model call. |
名前 | 説明 |
---|---|
| 実行される操作の名前。 |
| クライアントインストルメンテーションによって識別されるモデルプロバイダー。 |
| リクエストが行われているモデルの名前。 |
名前 | 説明 |
---|---|
| The format in which the generated image is returned. |
| The size of the image to generate. |
| The style of the image to generate. |
| AI レスポンスの一意の識別子。 |
| レスポンスを生成したモデルの名前。 |
| モデル入力 (プロンプト) で使用されるトークンの数。 |
| The number of tokens used in the model output (generation). |
| The total number of tokens used in the model exchange. |
| The full prompt sent to the model. Optional. |
For measuring user tokens, the previous table lists the values present in an observation trace. Use the metric name gen_ai.client.token.usage that is provided by the ImageModel . |
名前 | 説明 |
---|---|
| Event including the content of the image prompt. Optional. |
Image Prompt Data
The image prompt data is typically big and possibly containing sensitive information. For those reasons, it is not exported by default.
Spring AI supports exporting image prompt data as span events if you use an OpenTelemetry tracing backend, whereas data is exported as span attributes if you use an OpenZipkin tracing backend.
プロパティ | 説明 | デフォルト |
---|---|---|
|
|
|
If you enable the inclusion of the image prompt data in the observations, there’s a risk of exposing sensitive or private information. Please, be careful! |
Vector Stores
All vector store implementations in Spring AI are instrumented to provide metrics and distributed tracing data through Micrometer.
The db.vector.client.operation
observations are recorded when interacting with the Vector Store. They measure the time spent on the query
、add
、remove
operations and propagate the related tracing information.
名前 | 説明 |
---|---|
| The name of the operation or command being executed. One of |
| The database management system (DBMS) product as identified by the client instrumentation. One of |
| Spring AI のフレームワーク API の種類: |
名前 | 説明 |
---|---|
| The name of a collection (table, container) within the database. |
| The name of the database, fully qualified within the server address and port. |
| The record identifier if present. |
| The metric used in similarity search. |
| The dimension of the vector. |
| The name field as of the vector (e.g. a field name). |
| The content of the search query being executed. |
| The metadata filters used in the search query. |
| Returned documents from a similarity search query. Optional. |
| Similarity threshold that accepts all search scores. A threshold value of 0.0 means any similarity is accepted or disable the similarity threshold filtering. A threshold value of 1.0 means an exact match is required. |
| The top-k most similar vectors returned by a query. |
名前 | 説明 |
---|---|
| Event including the vector search response data. Optional. |
Response Data
The vector search response data is typically big and possibly containing sensitive information. For those reasons, it is not exported by default.
Spring AI supports exporting vector search response data as span events if you use an OpenTelemetry tracing backend, whereas data is exported as span attributes if you use an OpenZipkin tracing backend.
プロパティ | 説明 | デフォルト |
---|---|---|
|
|
|
If you enable the inclusion of the vector search response data in the observations, there’s a risk of exposing sensitive or private information. Please, be careful! |