Metrics
The Collaboration Server On-Premises application and the Collaboration Worker can serve metrics in the Prometheus text format. Use them to scale the containers that run the Coauthor sessions.
Each Coauthor session keeps an editor open in a container, and each container has a fixed number of slots for them. CPU and memory do not show how many slots are free. These metrics do, so you can add containers before new sessions fail.
The rest of the server keeps no such slots. To watch it, use the request logs and the resource use of your containers.
- Set
ENABLE_METRICS_ENDPOINT=trueto turn on the endpoint. It is off by default. - The endpoint is
GET /metricson port8099. UseMETRICS_HTTP_PORTto change the port. This port has no other route. - The port has no authentication. Do not publish it outside of your private network.
See the application variables and the Collaboration Worker variables.
The endpoint serves only these metrics:
| Metric | Type | Labels | Value |
|---|---|---|---|
cs_keep_alive_editors_open |
gauge | mode: rtc, detached |
Sessions that have a kept editor now. |
cs_keep_alive_editors_max_open |
gauge | none | Session slots of this container: the value of KEEP_ALIVE_EDITORS_MAX_OPEN_PAGES. |
cs_keep_alive_editor_route_requests_total |
counter | mode: rtc, detached; result: see below |
Requests to sessions, by what the caller got. |
The counter counts requests, not sessions. One session makes several requests.
What each container serves:
- The application with the built-in Collaboration Worker (
USE_BUILT_IN_COLLABORATION_WORKER=true): the 2 gauges and the counter. - The application with a separate Collaboration Worker (
USE_BUILT_IN_COLLABORATION_WORKER=false): only the counter. The application sends the requests to the workers. - The Collaboration Worker: only the 2 gauges.
The values of result:
success: a session ran the request, or closed the session.delayed:rtconly. No slot was free. The request ran without a kept editor and was slower.rejected:detachedonly. No slot was free for a new session. The request failed with HTTP 503.not_found:detachedonly. The session lost its editor, for example because the container that kept it stopped or is being removed. The request failed with HTTP 404. In normal operation this value does not grow.conflict:detachedonly. The session is already open. The request failed with HTTP 409.
result tells where the request went, not if the script succeeded. A later release can add result values. For an error ratio, use result!="success".
To scale, use the utilization over all containers that run sessions, and add containers above a target of about 70%:
sum(cs_keep_alive_editors_open) / sum(cs_keep_alive_editors_max_open)
Also watch the memory of each container. See Monitoring resources and the limits of a container.
To alert, use the requests that were slower or failed:
sum(increase(cs_keep_alive_editor_route_requests_total{result=~"delayed|rejected"}[5m])) > 0
It means that users got slower requests or HTTP 503: add containers now. Do not use it as the input of an autoscaler: it is 0 when you have the right number of containers, and also when you have too many.
To find out why a container was full, see the log lines.