To send OpenTelemetry metrics and traces generated by OpenLIT from your LLM Application to Elastic, Follow the below steps.

1

Get your Elastic APM Crednetials

  1. Sign in to your Elastc account.
  2. Open the side navigation and click on APM under Observability.
  3. Make sure the APM Server is running
  4. In the APM Agents section, Select OpenTelemetry and directly jump to Step 5 (Configure OpenTelemetry in your application):
  5. Copy and save the configuration value for OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS
    Replace the space after Bearer with %20: OTEL_EXPORTER_OTLP_HEADERS=“Authorization=Bearer%20[APIKEY]”
2

Add the following two lines to your application code:

import openlit

openlit.init(
  otlp_endpoint="YOUR_ELASTIC_OTEL_URL", 
  otlp_headers="YOUR_ELASTIC_OTEL_AUTH"
)

Replace:

  1. YOUR_ELASTIC_OTEL_URL with the OTEL_EXPORTER_OTLP_ENDPOINT value you copied in Step 1.
  • Example - https://38xxx.apm.us-central1.gcp.cloud.es.io:443
  1. YOUR_ELASTIC_OTEL_AUTH with the OTEL_EXPORTER_OTLP_HEADERS value you copied in Step 1.
  • Example - Authorization=Bearer%20<APIKEY>

Refer to the OpenLIT Python SDK repository for more advanced configurations and use cases.

3

Import the pre-built Dashboard

  1. Copy the dashboard NDJSON provided in the accordion named Dashboard below and save it in a file (.ndjson).
  2. Log into your Elastic Instance.
  3. Go to Stack Management > Saved Objects.
  4. Click Import and upload your file containing the dashboard NDJSON.
  5. Click Import and you should have the dashboard available.