Configure the OTLP receiver to collect LlamaIndex metrics

Configure the Splunk Distribution of the OpenTelemetry Collector to send LlamaIndex metrics to Splunk Observability Cloud.

You can monitor the performance of your LlamaIndex platform by configuring the Splunk Distribution of the OpenTelemetry Collector to send LlamaIndex metrics to Splunk Observability Cloud.

This solution requires instrumenting your LlamaIndex application using the splunk-otel-instrumentation-llamaindex library. This package enables OpenTelemetry-based telemetry collection for LlamaIndex workloads and helps send generated telemetry data to Splunk Observability Cloud through the Splunk Distribution of the OpenTelemetry Collector.

To use this data integration, you must have a running LlamaIndex application instrumented with the splunk-otel-instrumentation-llamaindex package. Install and configure the package by following the official package documentation.

  1. Once the package is installed and configured, define the required OpenTelemetry environment variables for your application.
    Example configuration:
    CODE
    export OTEL_SERVICE_NAME=llamaindex-circuit-demo
    export OTEL_INSTRUMENTATION_GENAI_EMITTERS=span_metric
    export OTEL_EXPORTER_OTLP_ENDPOINT=<OTLP-receiver-endpoint>
  2. Deploy the Splunk Distribution of the OpenTelemetry Collector to your host or container platform:
  3. Restart the Splunk Distribution of the OpenTelemetry Collector and LlamaIndex service to apply the configuration.

Configuration settings

Configuration settings for the OTLP receiver.

To view the configuration settings for the OTLP receiver, see Settings.

Metrics

The following metrics are available for LlamaIndex. For more information on these metrics, see Expected Output in the README.rst file of the splunk-otel-instrumentation-llamaindex directory.

These metrics are considered custom metrics in Splunk Observability Cloud.

Metric name Metric type Description
gen_ai.client.operation.duration histogram The total time taken for a GenAI operation (such as a chat completion, completion, or embedding request) from the moment the request is sent until the final response is received.
gen_ai.client.operation.time_to_first_chunk histogram Measures the time elapsed between sending the request and receiving the first response chunk/token from the model.
gen_ai.client.token.usage histogram Records the number of tokens consumed by the operation. Depending on the instrumentation and attributes attached, it may include input (prompt) tokens and output (completion) tokens.

Attributes

The following resource attributes are available for LlamaIndex.
Attribute name Description
gen_ai.framework The GenAI framework used by the application. For LlamaIndex applications, this value is llamaindex.
gen_ai.operation.name The type of GenAI operation performed, such as chat, which identifies the LLM interaction.
gen_ai.provider.name The GenAI provider used to process the request, such as cisco_circuit.
gen_ai.request.model The name of the model requested by the application to process the GenAI request.
gen_ai.response.model The name of the model that generated the response, when available.
gen_ai.token.type Identifies whether the reported token usage represents input (prompt) tokens or output (completion) tokens.