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

> Learn how to use the session duration test to monitor wall-clock session length

## Definition

The session duration test monitors the **wall-clock duration of a session** —
first-turn timestamp to last-turn timestamp. Unlike [Session latency](https://docs.openlayer.com/tests/catalog/session-latency.md),
which aggregates per-turn processing time, session duration captures the user-facing
end-to-end experience, including idle gaps between turns. 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

* Session duration is the cleanest proxy for "time spent by a user with the assistant".
  Comparing duration against goal achievement shows whether users who spend more time
  are getting more value.
* Sudden shifts in duration distribution (longer sessions, flatter distribution) are
  often an early warning for regressions in assistant quality.

## Available measurements

Units follow the timestamp column — typically seconds if `openlayer_prediction_timestamp`
is epoch seconds.

| Measurement | What it means |
| - | - |
| `meanSessionDuration` | Mean of per-session wall-clock durations (last-turn − first-turn) |
| `medianSessionDuration` | Median of per-session wall-clock durations |
| `meanTimeBetweenTurns` | Mean idle gap between consecutive turns, averaged across all sessions |

> [!NOTE]
>
> Sessions with only one turn are excluded from duration calculations — at least
> two timestamps are needed for a delta.

## Required columns

* **Session ID**: Groups turns belonging to the same conversation.
* **Timestamp**: Per-trace timestamp, used to compute duration as the delta between
  first and last turn.

## Test configuration examples

```json Monitoring theme={null}
[
  {
    "name": "Mean session duration below 10 min",
    "description": "Alert when average session wall-clock duration exceeds 10 minutes",
    "type": "performance",
    "subtype": "sessionDuration",
    "thresholds": [
      {
        "insightName": "sessionDuration",
        "measurement": "meanSessionDuration",
        "operator": "<=",
        "value": 600
      }
    ],
    "subpopulationFilters": null,
    "mode": "monitoring",
    "usesProductionData": true,
    "evaluationWindow": 3600,
    "delayWindow": 0
  }
]
```

## Related

* [Session latency](https://docs.openlayer.com/tests/catalog/session-latency.md) — per-turn processing time, different signal.
* [Session record count](https://docs.openlayer.com/tests/catalog/session-record-count.md) — number of turns, complementary to duration.


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