> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenLLMetry

> Learn how to export OpenLLMetry traces to Openlayer

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/zlWrng2mbxttdDP9/images/integrations/openllmetry_hero.png?fit=max&auto=format&n=zlWrng2mbxttdDP9&q=85&s=a3a4fb7ba38f8f9205652c6a00d62e7c" alt="OpenLLMetry hero" data-path="images/integrations/openllmetry_hero.png" />

[OpenLLMetry](https://www.traceloop.com/docs/openllmetry/introduction) (by Traceloop) is
an open-source project that makes it easy to monitor and trace the execution of LLM
applications. It builds on top of [OpenTelemetry](/integrations/opentelemetry) and captures traces in a non-intrusive way.

This guide shows how you can export traces captured by OpenLLMetry to Openlayer.

## Configuration

The integration works by sending trace data to Openlayer's [OpenTelemetry endpoint](/integrations/opentelemetry).

<Tip>
  The full code used in this guide is available
  [here](https://colab.research.google.com/github/openlayer-ai/openlayer-python/blob/main/examples/tracing/openllmetry/openllmetry_tracing.ipynb).
</Tip>

To set it up, you need to:

<Steps>
  <Step title="Set the environment variables">
    Set the following environment variables:

    ```bash theme={null}
    TRACELOOP_BASE_URL="https://api.openlayer.com/v1/otel"
    TRACELOOP_HEADERS="Authorization=Bearer%20YOUR_OPENLAYER_API_KEY_HERE, x-bt-parent=pipeline_id:YOUR_PIPELINE_ID_HERE"
    ```

    <Warning>
      Make sure to include `%20` between `Bearer` and your API key. It encodes the space character correctly in the `TRACELOOP_HEADERS` value.
    </Warning>
  </Step>

  <Step title="Initialize OpenLLMetry instrumentation">
    Initialize OpenLLMetry instrumentation in your application.

    ```python theme={null}
    from traceloop.sdk import Traceloop

    Traceloop.init(disable_batch=True)
    ```
  </Step>

  <Step title="Run LLMs and workflows as usual">
    Once instrumentation is set up, you can run your LLM calls as usual.
    Trace data will be automatically captured and exported to Openlayer, where
    you can begin testing and analyzing it.

    For example:

    ```python theme={null}
    from openai import OpenAI

    client = OpenAI()
    client.chat.completions.create(
      model="gpt-4o-mini",
      messages=[{"role": "user", "content": "How are you doing today?"}],
    )
    ```
  </Step>
</Steps>
