Collect metrics and traces from OpenAI services
Learn how to configure and activate the component for OpenAI services.
You can collect metrics and traces from OpenAI services by instrumenting your Python application using the Splunk Distribution of OpenTelemetry Python with the OpenTelemetry OpenAI instrumentation. The OpenAI instrumentation pushes metrics and traces to the OTLP receiver.
Complete the following steps to collect metrics and traces from OpenAI services.
- Deploy the Splunk Distribution of the OpenTelemetry Collector to your host or container platform:
- Start the Splunk Distribution of the OpenTelemetry Collector.
- Deploy the Python agent in your OpenAI service:
- Install the Splunk Distribution of OpenTelemetry Python using the guided setup or manual method.
- Install the Generative AI/LLM instrumentation by following the steps on OpenTelemetry OpenAI Instrumentation in the OpenTelemetry Python Contrib GitHub repository. You can use zero-code instrumentation or manual instrumentation.
- Run the service.
メトリクスと属性
OpenAI サービスで利用可能なモニタリングメトリクスを確認します。
| メトリクス名 | ヒストグラム機能 | インストルメントタイプ | ユニット(Units) | 説明 | リソース属性 |
|---|---|---|---|---|---|
gen_ai.client.token.usage | input | ヒストグラム | count | 処理済みの入力トークン数。 |
|
gen_ai.client.token.usage | 出力 | ヒストグラム | count | 処理済みの出力トークン数。 |
|
gen_ai.client.token.usage | sum | ヒストグラム | count | 処理済みトークンの合計。 |
|
gen_ai.client.token.usage | 最大 | ヒストグラム | count | 処理済み合計トークンの最大数。 |
|
gen_ai.client.token.usage | 分 | ヒストグラム | count | 処理済み合計トークンの最小数。 |
|
gen_ai.client.operation.duration | sum | ヒストグラム | いる | 期間の合計。 |
|
gen_ai.client.operation.duration | 最大 | ヒストグラム | いる | 最大期間。 |
|
gen_ai.client.operation.duration | 分 | ヒストグラム | いる | 最小期間。 |
|
gen_ai.client.operation.duration | count | ヒストグラム | count | 期間のカウント。 |
|
Next steps
How to monitor your AI components after you set up Observability for AI.
After you set up data collection from supported AI components to Splunk Observability Cloud, the data populates built-in experiences that you can use to monitor and troubleshoot your AI components.
| Monitoring tool | Use this tool to | Link to documentation |
|---|---|---|
| Built-in navigators | Orient and explore different layers of your AI tech stack. | |
| Built-in dashboards | Assess service, endpoint, and system health at a glance. | |
| Splunk Application Performance Monitoring (APM) service map and trace view | View all of your LLM service dependency graphs and user interactions in the service map or trace view. |