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

1

Install OpenTelemetry Collector (Optional)

This step is optional if you have the OpenTelemetry Collector already running.

For detailed installation instructions for the OpenTelemetry Collector , please refer to the OpenTelemetry Collector Documentation. This guide provides comprehensive steps to get you up and running with the Collector on various platforms.

2

Configure the OpenTelemetry Collector

  1. Configure HTTP Receiver: In the receivers section of your OpenTelemetry Collector config, ensure the http receiver is set with endpoint: 0.0.0.0:4318.

    receivers:
      otlp:
        protocols:
          http:
            endpoint: 0.0.0.0:4318
    
  2. Define Exporters: Add prometheusremotewrite and otlp exporters.

    exporters:
      prometheusremotewrite:
        endpoint: YOUR_PROMETHEUS_REMOTE_WRITE_URL
        add_metric_suffixes: false
      otlp:
        endpoint: YOUR_JAEGER_URL
    

    Replace:

    1. YOUR_PROMETHEUS_REMOTE_WRITE_URL with the Remote Write URL of Prometheus.
      • Example - https://prometheus.grafana.net/api/prom/push
    2. YOUR_JAEGER_URL with the URL of Jaeger
      • Example - jaeger:4317
  3. Assign Exporters to Pipelines: Link prometheusremotewrite to service.pipelines.metrics and otlp to service.pipelines.traces for data export.

    service:
      pipelines:
        traces:
          receivers: [ otlp ]
          exporters: [ otlp ]
        metrics:
          receivers: [ otlp ]
          exporters: [ prometheusremotewrite ]
    

Complete Configuration Example

3

Add the following two lines to your application code:

import openlit

openlit.init(
  otlp_endpoint="YOUR_OTELCOL_URL:4318", 
)

Replace:

  1. YOUR_OTELCOL_URL:4318 with the URL HTTP endpoint of your OpenTelemetry Collector.
    • Example - http://127.0.0.1:4318

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

4

Start monitoring using a pre-built Grafana dashboard

  1. Log into your Grafana Instance. To install Grafana, Refer to the Official documentation
  2. Make sure Prometheus and Jaeger are added as a datasource in Grafana. To add a new datasource, You can follow the steps in the Official documentation
  3. Once Prometheus and Jaeger are available as data source in Grafana, Click Dashboards in the primary menu.
  4. Click New and select Import in the drop-down menu.
  5. Copy the dashboard JSON provided in the accordion named Dashboard below.
  6. Paste the dashboard JSON text directly into the text area.
  7. Click Import.
  8. Save the dashboard.