[slmon2] Fix monitoring bugs and improve the UI - #11
Open
comoglu wants to merge 4 commits into
Open
Conversation
- main(): a KeyError on an unseen 'net.sta.loc.cha.type' key was silently swallowed, so any station/channel not present in the startup slinktool -Q snapshot (down at boot, or newly started since) never appeared on the dashboard again until a full restart. Now such channels are registered on first sight instead of dropped. - main(): pass a network timeout through to slclient.Input (-nt for slinktool) so a stalled SeedLink connection can't block the process forever with no self-recovery, matching the preexec_fn/SIGKILL cleanup already added in slclient.py. - main(): HTML/JSON regeneration used to be gated on receiving a new SeedLink record, so a station (or the whole feed) going completely silent -- the exact outage this tool exists to detect -- never triggered a re-render. A background timer now regenerates on a fixed interval regardless of record arrival, guarded by a lock so overlapping runs can't race on the output files. - load_station_coordinates(): add a timeout to the FDSNWS urlopen() call; an unreachable/slow server no longer stalls startup once per configured station. - generate_station_html(): don't paint 'n/a' cells with a stale leftover background color when feed/data latency are blanked out. - Remove a dead duplicate setActiveView() left over from an earlier edit; only the later, more complete copy was ever executing.
- Single source of truth for status colors (STATUS_STYLES): the CSS
(:root vars + .station-* classes), the browser-side JS
(getStatusColor/addMapLegend/cluster coloring), and Python's
getColor() were three independently hand-maintained palettes that had
drifted apart -- the same status could render a different color in
the table's Status cell vs its Latency cell vs the map. Also fixes
severity colors that weren't monotonic (hour-delayed rendered green,
reading as "healthy" despite being past most other delayed states)
and legends that silently covered only 6-8 of 12 statuses.
- Station detail is now an inline slide-over panel (720px, no-wrap
datetimes) instead of navigating to a separate NET_STA.html page, so
table/grid filters, scroll position, and map view survive opening
it. Old links keep working: NET_STA.html is now a lightweight
redirect stub to index.html?station=NET_STA, which also opens the
panel directly on load for bookmarks/shared links.
- liveurl templates support an additional {netsta} substitution token
(resolves to "NET.STA"), alongside the existing %s (station code
only). Purely additive/config-driven -- no behavior change for
existing %s-based liveurl values.
…r the antimeridian Leaflet plots raw longitude on a single, unwrapped copy of the world, so a station at e.g. -169 (Samoa/Tonga area) was rendered ~306 degrees from the AU/Pacific-centered map (lon ~134) -- numerically valid, but visually appearing near the Americas instead of next to Fiji/NZ across the date line, ~54 degrees away. Add normalizeLongitude()/mapRefLon(), applied only to the marker's plotted position and the auto-zoom bounds -- popups/labels keep showing the real (unwrapped) coordinate value so they stay factually correct.
…ver UTC renderDetailBody() computed Data/Feed Latency from Date.now() on the browser, so a skewed local clock on the viewer's machine threw off the displayed numbers. Use the server-computed ch.latency instead, and derive feed latency from it (dataLat - diff) so it never depends on "now" either.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three related changes to slmon2, from actually running it against a
1000+ station production feed for a while.
Bug fixes (silent data loss / hangs)
slinktool -Qsnapshot was silently swallowed, so anything down atboot (or newly started since) never appeared on the dashboard again
until a full restart.
stalled connection could block the process forever with no
self-recovery.
so a station (or the whole feed) going completely silent — the exact
outage this tool exists to detect — never triggered a re-render. A
background timer now regenerates on a fixed interval regardless.
UI
(CSS vars, JS, Python's
getColor()) into one source of truth. Theyhad drifted apart — the same status could render a different color
in the table's Status cell vs. its Latency cell vs. the map — and
some severity colors weren't monotonic (a "stale for over an hour"
status rendered green).
navigating to a separate page, so table/grid filters and scroll
position survive opening it. Old
NET_STA.htmllinks still work asredirect stubs.
liveurlconfig values now also support a{netsta}token("NET.STA"), alongside the existing
%s(station code only) —purely additive.
Map fix
rendering ~300° from an Australia/Pacific-centered map — numerically
valid, but visually on the wrong side of the world. Longitude is now
normalized to the map's reference point for marker placement only;
popups/labels still show the real coordinate.
Tested end-to-end against a real ~1000-station config in
-g(generate-only) mode, plus rendered screenshots of all three views and
the detail panel.