Rooms, people, and memory
How collaboration server telemetry counts people and memory per room, finds large rooms without room names in metrics, and labels metrics by room.
@docx-editor.dev/telemetry is available in version 2.29.0 and later.For setup, see Collaboration servers.
Configure room measurements
Pass room options to roomTelemetry or withCollaborationTelemetry:
import { prometheusRegistry } from '@docx-editor.dev/telemetry/prometheus';
import { hmacRoomLabel, roomTelemetry } from '@docx-editor.dev/telemetry/server';
const metrics = prometheusRegistry();
const rooms = roomTelemetry({
exporters: [metrics],
roomLabel: hmacRoomLabel(process.env.ROOM_LABEL_SECRET),
});| Option | Default | Description |
|---|---|---|
sampleInterval | 60000 ms | false stops the timer. Then call rooms.sample(), or pass sampleBeforeScrape: rooms to serveMetrics. |
measureState | true | Encodes changed rooms' Yjs state once per sample. |
roomLabel | Process-local index, such as room-3 | hmacRoomLabel(secret) gives a stable hidden label and throws on an empty secret. (name) => name shows names. |
perRoomSeries | false | Adds room-labeled gauges. |
Interpret room counts and memory
- Participants come from awareness states, so they count tabs, not people.
- Connections count separately, one per socket and room.
- Memory is encoded Yjs state, stored files, and updates awaiting storage. It is not heap usage. Compare it with process memory metrics.
- Histograms record one entry per room per sample. For queries, see Dashboards.
Inspect an individual room
Expose rooms.list() only to administrators. Each row has room, participants, connections, stateBytes, blobBytes, pendingBytes, nodes, ageSeconds, idleSeconds, and limitRatio (largest share of any room limit).
With perRoomSeries: true, each room gets docx_editor_collab_room_participants_current and docx_editor_collab_room_memory_current_bytes gauges. Only the default label or hmacRoomLabel is accepted; any other roomLabel throws. Series end when the room closes.
Limits
- With Redis, instances report overlapping participants. Never add them.
- With
perRoomSeries, take the per-roommax, then sum. Without it, the globalmaxis a lower bound unless all instances hold the same rooms. - With Redis, only the store-lock holder stores. Skipped stores are not timed, and pending updates stay pending per instance.
- Each room adds series. Disable
perRoomSerieson servers with many rooms.