> ## 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**: <Tooltip tip="Continuously evaluate your models and datasets as you iterate on their versions.">development</Tooltip>
  and <Tooltip tip="Monitor a model in production, measure its health, check for drifts and set up alerts.">monitoring</Tooltip>.
* **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.
</Note>

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

<CodeGroup>
  ```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
    }
  ]
  ```
</CodeGroup>

## Related

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