From 330baa6cc39bffca1159e5eb05a834f03d757de9 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Fri, 19 Jan 2024 17:44:49 +0100 Subject: [PATCH] docs: add changelog for #12326 --- changes/ce/feat-12326.en.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 changes/ce/feat-12326.en.md diff --git a/changes/ce/feat-12326.en.md b/changes/ce/feat-12326.en.md new file mode 100644 index 000000000..bfef51eb8 --- /dev/null +++ b/changes/ce/feat-12326.en.md @@ -0,0 +1,14 @@ +Add session registration history. + +Setting config `broker.session_history_retain` allows EMQX to keep track of expired sessions for the retained period. + +API `GET /api/v5/sessions_count?since=1705682238` can be called to count the cluster-wide sessions which were alive (unexpired) since the provided timestamp (UNIX epoch at seconds precision). + +A new gauge `cluster_sessions` is added to the metrics collection. Exposed to prometheus as + +``` +# TYPE emqx_cluster_sessions_count gauge +emqx_cluster_sessions_count 1234 +``` + +The counter can only be used for an approximate estimation as the collection and calculations are async.