Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

Telemetry-dashboard capability: a read-only, retroactive rollup of the per-job telemetry.json the latexml-oxide cortex_worker writes into every result archive, across a completed (corpus, service) run.

Follows the symmetry contract — one shared crate::telemetry::TelemetrySummary is the read model for both the agent API (GET /api/telemetry/<corpus>/<service>) and the server-rendered human screen (telemetry_report_page, GET /telemetry/<corpus>/<service>). Both live at top-level /telemetry / /api/telemetry prefixes (like the /document/... report screens) so neither collides with the same-shape /corpus/<c>/<s>/<severity> report routes. Because a summary aggregates thousands of result archives off disk (a multi-second scan), it is memoized in an in-memory TelemetryCache with a short TTL rather than recomputed per request. The heavy read happens off both the cache lock and the pooled DB connection.

Structs§

TelemetryCache
In-memory TTL cache of computed telemetry summaries, keyed by (corpus_id, service_id). A summary aggregates every result archive of a completed run (a multi-second disk scan over thousands of ZIPs), so it is memoized for [TELEMETRY_TTL] rather than recomputed per request. A plain Mutex<HashMap> suffices — the entry set is tiny (one per viewed scope) and writes are rare; the heavy aggregation runs outside the lock.

Functions§

api_telemetry
The telemetry rollup as an agent API (the JSON twin of telemetry_report_page): wall/RSS percentiles, per-phase P99, outcome mix, and witness papers for a completed (corpus, service) run. Served from the shared TelemetryCache. 404 on an unknown corpus/service, 503 if the pool is exhausted.
routes
The route set for the telemetry-dashboard capability (the agent API + the human screen).
telemetry_report_page
The telemetry dashboard screen (HTML twin of api_telemetry): the same rolled-up run telemetry, rendered as an outcome mix, wall/RSS percentile tables, a per-phase P99 bar list, and the slowest / highest-RSS witness papers (each linking into its per-article forensics). 404 on an unknown corpus/service, 503 if the pool is exhausted.