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),
});
OptionDefaultDescription
sampleInterval60000 msfalse stops the timer. Then call rooms.sample(), or pass sampleBeforeScrape: rooms to serveMetrics.
measureStatetrueEncodes changed rooms' Yjs state once per sample.
roomLabelProcess-local index, such as room-3hmacRoomLabel(secret) gives a stable hidden label and throws on an empty secret. (name) => name shows names.
perRoomSeriesfalseAdds 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-room max, then sum. Without it, the global max is 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 perRoomSeries on servers with many rooms.

See also