Skip to content

Add a disconnected PVs report - #58

Merged
slominskir merged 1 commit into
mainfrom
disconnected-pvs-report
Oct 5, 2026
Merged

slominskir merged 1 commit into
mainfrom
disconnected-pvs-report

Conversation

@slominskir-coding-agent

Copy link
Copy Markdown
Contributor

What changed

A new page, /disconnected-pvs, linked from the overview page under "Reports". It's for people such as IOC maintainers. It lists the same PVs as /healthcheck: PVs disconnected or never connected for longer than HEALTHCHECK_GRACE_SECONDS, plus frozen PVs. For each PV it shows:

  • Clients, from the WebSocket session data (clientName, IP). epics2web.js sends the page address as clientName by default, and WEDM doesn't override it. So a WEDM screen is shown by its edl value and linked to the screen. Sessions with the same name are grouped (×N). Only http/https names become links, and all output is escaped.
  • IOC, which the browser looks up in MYA through myquery's GET /channel?q=<pv>&l=50&m=<deployment>. q is a SQL LIKE pattern, so only the exact name match is kept. The IOC column fills in after the page loads, with four lookups at a time. active=false shows as "no longer archived". PVs with no IOC are grouped as "Not archived", "Archived without an IOC" or "Lookup failed".
  • Via, the server CAJ last connected the channel to, which at JLab is usually the CA gateway. ChannelMonitor now records channel.getTransport().getRemoteAddress() on each connect. This runs on the callbackExecutor, not inside a CAJ callback. The report shows it as host:port, with reverse DNS cached in ServerNames.

The page has four sections: Summary counts, By IOC (built in JS once the lookups finish), By Client, and PVs.

The healthcheck's PV selection moves to UnhealthyPvs, so both pages list the same PVs. /healthcheck now lists them sorted by name instead of in HashMap order. Its JSON fields and status codes are otherwise unchanged.

New settings (in the README under Healthcheck → "Disconnected PVs report")

Variable Default Meaning
MYQUERY_URL /myquery Where the browser sends lookups. The default is a relative path, so it reaches myquery on the same proxy host (epicsweb.jlab.org/myquery). Empty turns the lookup off.
MYQUERY_DEPLOYMENT ops MYA deployment (myquery's m).

Deployment

None if the defaults suit the ops fiefdom. Question for the reviewer: should other fiefdoms (chl, srf, …) set MYQUERY_DEPLOYMENT, if their PVs are archived in another MYA deployment?

Checks

  • ./gradlew spotlessCheck test: passed, 81 unit tests (19 of them new: UnhealthyPvsTest, ClientLabelTest, DisconnectedPvReportTest, plus additions to ApplicationTest).
  • ./gradlew integrationTest: passed, 25 tests (22 existing + 3 new). The image was built with the repo Dockerfile (docker compose -f build.yaml build --build-arg CUSTOM_CRT_URL=). The new DisconnectedPvsTest checks three things:
    • the overview links to the report
    • a WEDM clientName is shown and linked by its EDL, and a hostile name is escaped
    • stopping softioc lists channel1 with a …:5064 Via
  • In an earlier session, the page was checked by hand in headless Chromium against a stub myquery:
    • only the exact name is kept when another PV also matches the pattern
    • inactive, null-IOC and HTTP 500 lookups
    • the By IOC grouping
    • MYQUERY_URL=""
    • the empty state
    • the minified JS

Not verified

  • Real myquery/MYA weren't reachable. Still to check at JLab:
    • the same-origin path through the epicsweb proxy
    • what ioc values look like
    • how long lookups take in a large outage (one request per PV)
  • Reverse DNS for Via showed IPs in Docker; at JLab it should show gateway host names.
  • No real WEDM session was tried; the URL format comes from WEDM's source (screen.js).

Decisions

  • Gateways are almost always used, so Via usually names the gateway. The IOC therefore comes from an outside lookup, and myquery/MYA is the source available now. JLab doesn't use ChannelFinder.
  • The lookup runs in the browser, not in epics2web. This keeps epics2web from making new outbound calls, keeps a slow myquery from tying up its threads, and lets the page show at once while the IOC column fills in.
  • There's no JSON variant: the report is only for people to read.
  • Times are formatted in Java, not with fmt:formatDate. JSTL falls back to Date.toString() when a request has no Accept-Language, and the JS compares the time strings to find the earliest.
  • Left for later: a CED web service lookup, or wioc or an EPICS name server, as further sources. Each would be another lookup function in disconnected-pvs.js, tried when the first finds nothing.

🤖 Generated with Claude Code

https://claude.ai/code/session_017sRPCQkg9smoVJvSLJDQXb

Add /disconnected-pvs, linked from the overview page, a report for
people such as IOC maintainers of the PVs /healthcheck lists. It shows
each PV with the clients that monitor it, a WEDM screen by its EDL file
and linked to the screen, and groups the PVs by client and by IOC.

The IOC comes from the MYA archiver: the browser looks each PV up with
myquery's channel search, at MYQUERY_URL (default /myquery, on the same
host) in MYQUERY_DEPLOYMENT (default ops); an empty MYQUERY_URL turns
the lookup off. A PV's IOC can't come from CA once it's disconnected,
and epics2web usually reaches IOCs through gateways, so the report also
shows the server each PV was last reached through, which ChannelMonitor
now records on connect.

The healthcheck's selection of PVs moves to UnhealthyPvs, so both pages
list the same PVs; the healthcheck now lists them by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sRPCQkg9smoVJvSLJDQXb
@slominskir
slominskir merged commit e930f22 into main Oct 5, 2026
6 checks passed
@slominskir
slominskir deleted the disconnected-pvs-report branch October 5, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

source::ai Work done by an AI agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant