Skip to content

Add CountSessions to summarise mux session state - #257

Open
liam-lowe wants to merge 1 commit into
mainfrom
liam-lowe/mux-session-counts
Open

Add CountSessions to summarise mux session state#257
liam-lowe wants to merge 1 commit into
mainfrom
liam-lowe/mux-session-counts

Conversation

@liam-lowe

@liam-lowe liam-lowe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

We need more detail to breakdown state of a mux manager's sessions.

Introduces CountSessions which returns a breakdown: connected, errored, closed and total.

The manager's existing once-a-minute "MuxManager status" log line prints these. In future, these will be used for across-group aggregation of state.

It will log:

MuxManager status  {"component": "MuxManager-a", "shutdown": false, "name": "a",
                    "counts": "connected=3/4 errored=1 closed=0", "sessions": "..."}

Where connected is logging: connected / total - and the remaining indicates the state of non-connected muxes.

@liam-lowe
liam-lowe requested a review from a team as a code owner August 20, 2026 20:31
@liam-lowe
liam-lowe force-pushed the liam-lowe/mux-session-counts branch from 6bc3014 to 2e348f3 Compare August 21, 2026 00:55
@liam-lowe liam-lowe changed the title Add CountSessions to summarise mux session state Add CountSessions to mux session state Aug 24, 2026
@liam-lowe liam-lowe changed the title Add CountSessions to mux session state Add CountSessions to summarise mux session state Aug 24, 2026
@liam-lowe
liam-lowe force-pushed the liam-lowe/mux-session-counts branch from 2e348f3 to d938b71 Compare August 24, 2026 18:57
Nothing reports the breakdown of a mux manager's sessions.
num_muxes_active is the size of the session map. mux_connection_active is per session.
A session failing its health check but still in the map therefore reads as healthy in both.

CountSessions returns connected, errored, closed and total.
Connected against Total is the signal a caller wants: a manager holding one of ten sessions is in a very different state from one holding ten.

The manager's existing once-a-minute status line now carries those counts.
SessionCounts renders itself, so the counts are one tag rather than four, and the rendering is unit tested even though the log call is not.

This also repairs the NewGRPCMuxManager doc comment.
DesiredMuxCount was inserted between that comment and its function.
Its first two lines ended up documenting DesiredMuxCount instead.
@liam-lowe
liam-lowe force-pushed the liam-lowe/mux-session-counts branch from d938b71 to c34c1b7 Compare August 24, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant