Skip to content

display connection stats in web UI#30

Merged
tridge merged 7 commits intoArduPilot:mainfrom
tridge:pr-web-connection-stats
May 9, 2026
Merged

display connection stats in web UI#30
tridge merged 7 commits intoArduPilot:mainfrom
tridge:pr-web-connection-stats

Conversation

@tridge
Copy link
Copy Markdown
Contributor

@tridge tridge commented May 9, 2026

image

tridge and others added 7 commits May 9, 2026 13:54
Adds a sidecar TDB written by each per-port-pair child whenever a
connection appears or changes. The udpproxy parent recreates the file
at startup and clears records for exiting / removed entries. Web admin
and CLI tools read this to render who is currently connected.

Snapshot is throttled (10s) and forked into a grandchild, mirroring
the save_signing_timestamp pattern in mavlink.cpp so main_loop never
blocks on disk I/O. New connections reset the throttle to 0 so the
record appears on the next loop iteration without waiting a full tick.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Parses ConnEntry records using the same forward-compatible scheme as
keydb_lib (>= MIN_SIZE accepted, trailing bytes preserved on read).
Exposes iter_active() / list_active() with a 30s stale-record filter
as defence in depth against orphans the parent failed to clean up.
Used by webadmin/connections.py and the keydb.py stats command.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New /admin/connections route lists every active connection across
all entries (peer, transport, uptime, rx/tx). The owner /me/ page
gains a per-entry section showing only that owner's own connections.
Both pages auto-refresh every 10s via a meta refresh in the new
head_extra block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Loads the running build's hash from a git-version.txt file written
into the repo by scripts/update_server.sh before rsync (.git/ itself
is excluded from rsync, so reading the live hash on the server isn't
viable). Falls back to live git rev-parse for local dev.

The GitHub repo URL defaults to ArduPilot/UDPProxy and is overridable
via webui.json's "github_repo" field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reads connections.tdb (sibling of keys.tdb) via conntdb_lib and
prints one line per active connection, joined with the entry's
name from keys.tdb. Convenient for quick on-server checks without
loading the web UI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related deploy fixes:
- Capture the local 'git rev-parse --short HEAD' into git-version.txt
  before rsync so the deployed web UI can show the running commit
  in its footer (the .git directory itself is excluded from rsync).
- pkill the webadmin gunicorn alongside udpproxy. start_proxy.sh
  skips relaunching gunicorn if one's already up, so without this
  step the new code is rsynced but the old worker keeps serving.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
keydb.py imports conntdb_lib at startup (for the new 'stats' command),
so the runtime stage of docker/Dockerfile needs the file alongside
keydb.py / keydb_lib.py. Without this the 'docker-test' CI job fails
with ModuleNotFoundError on any keydb.py invocation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tridge tridge merged commit 73eeecc into ArduPilot:main May 9, 2026
2 checks passed
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