fix(poi): stop a successful import reporting itself as failed; wire the textfile collector #22
No reviewers
Labels
No labels
dependencies
major
security-pin
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
trails-cool/trails!22
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/poi-import-textfile-metrics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two defects found while installing the POI refresh timers for #19. Both only surface on the monthly run, which is why neither showed up in the July bootstrap import.
1. A successful import would have reported itself as failed
emit_metricis the last command a successful import runs, and its final act is:poi-import.servicesetsNODE_EXPORTER_TEXTFILE_DIR=/var/lib/node_exporter/textfile_collector, and that directory did not exist on the flagship. Underset -euo pipefailthe failingmvbecomes the script's exit status — so systemd would have recordedpoi-import.serviceas failed after an import that fetched, verified, classified and atomically swapped 8.4M rows successfully.Verified against the pre-fix script, simulating the final line with the directory absent:
The
REACHED: script continuedline never prints. The function's own comment already says "best-effort", so this makes it true:mkdir -pthe target, guard every step, alwaysreturn 0.2. The metrics had nowhere to go anyway
node-exporterran without--collector.textfile.directoryand without that path mounted, sopoi_import_last_status,_last_rowsand_last_success_timestamp_secondswere written to disk and silently dropped. Confirmed against production Prometheus — the query returns an empty result whilepoi_index_age_secondsreturns fine.That mattered more than a missing gauge: the
poi-index-stalealert annotation tells the operator to "Check … the Planner dashboard: Last Import Status", a panel fed by exactly these metrics. The alert's own remediation step led somewhere permanently blank.3. Ownership, found while fixing 2
node-exporterruns asnobody(uid 65534) — confirmed withdocker exec … id— butmktempcreates files mode0600root-owned. Wiring the collector alone would still have yielded nothing readable, so the file is nowchmod 0644before publishing.Scope note
poi_index_age_secondsis published by the Planner from its own DB and is whatpoi-index-staleactually evaluates, so index staleness was always covered. What was missing is per-run outcome detail — "the import ran and failed" as distinct from "the data is getting old", which is the difference between catching a failure the next morning and catching it six weeks later.Verification
Failure paths exercised in a harness extracting the real function:
0644, exit 0WARNlogged, exit 0NODE_EXPORTER_TEXTFILE_DIRunsetstatus=0)_last_success_timestamp_secondsdocker compose configvalidates, and the resolved mount reportscreate_host_path: true— Docker creates the host directory itself, so themkdiris belt-and-braces rather than a standing prerequisite.Deploys via
cd-infra(pathinfrastructure/);node-exporteris already in itsup -dlist, so the collector flag lands on merge. Worth a manualsystemctl start poi-import.serviceafterwards to confirm the unit now exits 0 and the metric reaches Prometheus, rather than waiting for Aug 2.Both timers are installed and enabled as of today: extract Aug 1 02:44 UTC on the BRouter host, import Aug 2 04:11 UTC on the flagship.
Refs #19