Skip to content

Print the sent counts on the periodic [stats] line - #66

Merged
mondain merged 1 commit into
mainfrom
feat/cli-sent-counters
Nov 19, 2026
Merged

mondain merged 1 commit into
mainfrom
feat/cli-sent-counters

Conversation

@mondain

@mondain mondain commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #60. Covers the sent_objects and sent_bytes request; the one-time line for an accepted namespace is not in this PR.

The [stats] line now ends with sent_objects=N sent_bytes=B: what moqxr has written, read through Publisher::stats() while the publish runs. They add up over the connections of the run, so a reconnection does not start them again at 0, and [final] uses the same sum. They read unknown before the first reading. After a publish that ended without a final count, [final] gives the last reading instead of unknown.

The zeros that #60 reported at exit come from moqxr, which dropped the counts of a session that ended in a failure. That is fixed in openmoq/moqxr#152. This PR does not need it for the periodic line, which reads the live session. It needs a moqxr release with it for [final] to give the exact count after a failed publish, until then the last reading stands in.

Not done: the one-time line when the relay accepts the namespace. moqxr has no event or flag for it yet.

Tested: new unit checks for the readings and the [final] fallback in moqt_draft_test, and a guard in cli-final-stats-guards.sh. All tests pass except moq2ts-srt-listener-tests and moq2ts-srt-link-stats-tests, which segfault on main too. I did not run it against a relay.


This change is Reviewable

The [stats] line counted what the pipeline hands over, so a supervisor
could not tell what reached the relay until [final], and not at all after
a run that was stopped or failed.

Read moqxr's counts through Publisher::stats() while the publish runs and
add sent_objects and sent_bytes to the line. They add up over the
connections of a run, so a reconnection does not start them again at 0.
[final] uses the same sum, and after a publish that ended without a final
count it gives the last reading in place of unknown.

Refs #60
@mondain
mondain merged commit f65a9d4 into main Nov 19, 2026
4 checks passed
@gwendalsimon

Copy link
Copy Markdown
Contributor

Thanks for this. One issue: when a connection fails (MoqxrPublisher.cpp:422-451), the loop continues to the reconnect before the stats() add at :472-482, so the failed connection's sent counts are never summed and [stats] freezes, then restarts from the new connection. Adding stats() to m_sentEnded before that continue fixes it. Also, exact [final] counts after a failure need moqxr v0.4.21 (#152); main pins v0.4.18.

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.

2 participants