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

# Session latency

> Learn how to use the session latency test to monitor per-turn latency aggregated per session

## Definition

The session latency test monitors **cumulative model latency per session**. For each
session, Openlayer sums per-trace latency across all turns, then exposes window-level
aggregates you can threshold against. No LLM evaluator is involved — it's a
deterministic aggregation.

## Taxonomy

* **Task types**: LLM.
* **Availability**: development (Continuously evaluate your models and datasets as you iterate on their versions.)
  and monitoring (Monitor a model in production, measure its health, check for drifts and set up alerts.).
* **Evaluation level**: session.
* **Computation**: deterministic aggregation.

## Why it matters

* Per-trace latency is the standard monitoring signal, but total latency within a
  session is what the user actually waits through.
* A session that accumulates 15 turns × 3 seconds is a materially different user
  experience from a single 45-second turn — this metric captures the former.

## Available measurements

| Measurement | What it means |
| - | - |
| `totalLatency` | Sum of per-trace latency across **all traces in the window** (global, not per-session) |
| `meanLatencyPerSession` | Mean of per-session latency sums across sessions in the window |
| `medianLatencyPerSession` | Median of per-session latency sums across sessions in the window |

> [!NOTE]
>
> Per-session latency is the **sum** of all trace latencies in that session, not
> a per-turn average. `meanLatencyPerSession` is then the mean across sessions
> of those per-session sums.

## Required columns

* **Session ID**: Groups turns belonging to the same conversation.
* **Latency**: Per-trace latency (units follow the `openlayer_latency` column;
  usually populated automatically by the Openlayer client or via OpenTelemetry).

## Test configuration examples

```json Monitoring theme={null}
[
  {
    "name": "Mean session latency below 30s",
    "description": "Alert when the mean cumulative session latency exceeds 30 seconds",
    "type": "performance",
    "subtype": "sessionLatency",
    "thresholds": [
      {
        "insightName": "sessionLatency",
        "measurement": "meanLatencyPerSession",
        "operator": "<=",
        "value": 30000
      }
    ],
    "subpopulationFilters": null,
    "mode": "monitoring",
    "usesProductionData": true,
    "evaluationWindow": 3600,
    "delayWindow": 0
  }
]
```

## Related

* [Session duration](https://docs.openlayer.com/tests/catalog/session-duration.md) — wall-clock session length, different signal.
* [Mean latency](https://docs.openlayer.com/tests/catalog/mean-latency.md), [Max latency](https://docs.openlayer.com/tests/catalog/max-latency.md), [p95 latency](https://docs.openlayer.com/tests/catalog/p95-latency.md) — trace-level latency metrics.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.