Configure the OTLP receiver to collect LangChain metrics
Learn how to configure the OTLP receiver to collect LangChain metrics.
You can monitor the performance of LangChain large-language model (LLM) services by configuring your LangChain services to send metrics to Splunk Observability Cloud. This solution uses the OTLP receiver with the LangChain instrumentation, which collects metrics from LangChain services by automatically setting up OpenTelemetry to track performance and statistics.
Complete the following steps to collect metrics from and monitor the performance of LangChain services.
Prerequisite
Learn how to initialize the LangChain instrumentation in your service.
To use the OTLP receiver to collect metrics from LangChain, you must initialize the LangChain instrumentation in your service.
from opentelemetry.instrumentation.langchain import
LangChainInstrumentor
LangChainInstrumentor().instrument()
Configure and activate the component for LangChain
Learn how to configure and activate the component to monitor LangChain services.
Complete the following steps to configure and activate the component for LangChain.
Monitor the performance of LangChain services
Learn how to navigate to the LangChain navigator, which you can use to monitor the performance of LangChain services.
Complete the following steps to access the LangChain navigator and monitor the performance of LangChain services. For more information on navigators, see Use navigators and Monitor LLM costs with navigators.
- From the Splunk Observability Cloud main menu, select Infrastructure.
- Under AI/ML, select AI Frameworks.
- Select the LangChain summary card.
Configuration settings
Learn about the configuration settings for the OTLP receiver.
To view the configuration options for the OTLP receiver, see Settings.
Metrics
Learn about the monitoring metrics available for LangChain services.
Metric name | Type | Unit | Description |
---|---|---|---|
gen_ai.client.operation.duration | float | s | The duration of the GenAI operation. |
gen_ai.client.token.usage | int | count | Measures the number of input (prompt) and output (completions) tokens used. |
Attributes
Learn about the resource attributes available for LangChain services.
OpenTelemetry attribute name | Description |
---|---|
telemetry.sdk.name | The name of the telemetry SDK. |
telemetry.sdk.language | The language of the telemetry SDK. |
telemetry.sdk.version | The version string of the telemetry SDK. |
deployment.environment | The environment where the GenAI service is running. |
service.name | The name of the service. |
host.name | The name of the host. |
os.type | The OS type. |
Troubleshoot
Learn how to get help if you can't see your data in Splunk Observability Cloud.
If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways:
Splunk Observability Cloud customers can submit a case in the Splunk Support Portal or contact Splunk Support.
Prospective customers and free trial users can ask a question and get answers through community support in the Splunk Community.