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

> Learn how to use the session record count test to monitor the number of records (turns) per session

## Definition

The session record count test monitors the **number of records** — typically turns —
per session. It's a numeric test (no LLM evaluator involved) that aggregates the row
count per session ID and lets you alert on pathological cases: runaway sessions with
hundreds of turns, or sessions that never went past one.

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

* Runaway sessions (too many turns) often signal tool-call loops, clarification loops,
  or frustrated users hammering on the same question.
* Very short sessions (one turn then drop-off) may signal users bouncing off the
  product before the assistant could help.
* Track both tails — mean and percentile views of session length often tell very
  different stories.

## Available measurements

| Measurement               | What it means                                     |
| ------------------------- | ------------------------------------------------- |
| `totalSessions`           | Number of sessions in the window                  |
| `meanRecordsPerSession`   | Average number of records per session             |
| `medianRecordsPerSession` | Median number of records per session              |
| `stdRecordsPerSession`    | Standard deviation of records per session         |
| `minRecordsPerSession`    | Shortest session in the window                    |
| `maxRecordsPerSession`    | Longest session in the window                     |
| `p90RecordsPerSession`    | 90th-percentile session length                    |
| `p95RecordsPerSession`    | 95th-percentile session length                    |
| `p99RecordsPerSession`    | 99th-percentile session length                    |
| `shortSessionCount`       | Count of sessions below a short-session threshold |
| `mediumSessionCount`      | Count of sessions in the medium-length band       |
| `longSessionCount`        | Count of sessions above a long-session threshold  |

## Required columns

* **Session ID**: Groups turns belonging to the same conversation.

## Test configuration examples

<CodeGroup>
  ```json Monitoring theme={null}
  [
    {
      "name": "Mean records per session below 20",
      "description": "Alert when average session length exceeds 20 turns",
      "type": "performance",
      "subtype": "sessionRecordCount",
      "thresholds": [
        {
          "insightName": "sessionRecordCount",
          "measurement": "meanRecordsPerSession",
          "operator": "<=",
          "value": 20
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600,
      "delayWindow": 0
    }
  ]
  ```
</CodeGroup>

## Related

* [Session duration](/tests/catalog/session-duration) — wall-clock view of session length.
* [Session cost](/tests/catalog/session-cost), [Session token count](/tests/catalog/session-token-count) — cost and token aggregates per session.
