> ## 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.

# Observability

> See every gateway request as a trace in your Openlayer project, with no instrumentation

Every request through the gateway can be published as a trace in Openlayer, with no code in your
apps. It's the visibility side of the gateway: while usage limits and guardrails enforce your rules,
observability shows you what actually happened.

## Connect your Openlayer project

On the **Config** page, under **Observability**:

* Turn observability **on**.
* Set the **Openlayer API key env var**, the name of the environment variable holding your Openlayer key (set on the gateway host).
* Paste your **inference pipeline ID** from the Openlayer project you want traces to land in.

Save, and new requests start showing up as traces in that project.

## What's in a trace

Each trace captures the full shape of the request:

* The **model** and **provider** that served it.
* **Input** messages and the **output** text.
* **Tokens**, **latency**, and **cost**.
* **Status**, success or error, with the error message when one occurs.
* Any **guardrail** violations, as steps in the trace.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/2eGfXTpwMAOWCnGg/images/gateway/gateway_trace.png?fit=max&auto=format&n=2eGfXTpwMAOWCnGg&q=85&s=9bdc0c30431f87899e5c79d81a7318df" alt="Every gateway request becomes a trace in Openlayer" data-path="images/gateway/gateway_trace.png" />

## Attribute traffic to a user

When an [API key](/gateway/api-keys) is created with a **User ID**, every request it makes carries
that ID into the trace. In Openlayer you can then group and filter traffic by user.

## It never blocks a response

Tracing is fire-and-forget. The gateway sends each trace in the background after the response has
gone out, so observability never slows a request down, and never fails one if Openlayer is
unreachable.

## Correlate with your logs

Send an `X-Request-ID` header with a request and the gateway uses it as the trace ID, so you can
line up your own logs with the trace in Openlayer. Omit it and the gateway generates one.

## Go further

Traces are the foundation for Openlayer's monitoring: run tests on your live traffic, track quality
over time, and get alerted when something regresses. See the
[Observability section](/monitoring/overview) to set that up.
