Tests: the log's fields and the metrics Grafana reads #403

Closed
opened 2026-11-06 19:51:44 -08:00 by rays · 1 comment
Owner

logging.rs is at 50% and the directory's otel.rs at 61% (format_event); metrics.rs's serving path is partly untested. The dashboard and the alert rules read the log's fields (ev, feed, new, bytes, msg, error.type) and the metrics' names (CLAUDE.md: rename one and its panels go blank without an error). Nothing tests that they are what the dashboard expects.

Tests to add:

  • with IPX_LOG_FORMAT=json, a scan's events are one JSON object a line with the fields grafana/dashboard.py and grafana/alerts.py query, and a line inside a span carries trace_id and span_id
  • the directory's JSON lines carry theirs (message, instance, accepted, the refused_* counts)
  • every metric name the dashboard and alerts query is served by /metrics (check by reading the names out of dashboard.py and alerts.py)

Seen with the coverage of both suites merged line by line (cargo: sh scripts/coverage.sh, browser: sh scripts/coverage.sh api; reports in target/coverage/cargo, api and page; #390, #394), as of 2026-11-07. A test added here shows in Grafana's Coverage row at the next run.

logging.rs is at 50% and the directory's otel.rs at 61% (`format_event`); metrics.rs's serving path is partly untested. The dashboard and the alert rules read the log's fields (`ev`, `feed`, `new`, `bytes`, `msg`, `error.type`) and the metrics' names (CLAUDE.md: rename one and its panels go blank without an error). Nothing tests that they are what the dashboard expects. Tests to add: - with IPX_LOG_FORMAT=json, a scan's events are one JSON object a line with the fields grafana/dashboard.py and grafana/alerts.py query, and a line inside a span carries `trace_id` and `span_id` - the directory's JSON lines carry theirs (`message`, `instance`, `accepted`, the `refused_*` counts) - every metric name the dashboard and alerts query is served by /metrics (check by reading the names out of dashboard.py and alerts.py) Seen with the coverage of both suites merged line by line (cargo: `sh scripts/coverage.sh`, browser: `sh scripts/coverage.sh api`; reports in target/coverage/cargo, api and page; #390, #394), as of 2026-11-07. A test added here shows in Grafana's Coverage row at the next run.
rays added the enhancement label 2026-11-06 19:51:44 -08:00
Author
Owner

Tests added in b62182e: every ipx_ metric grafana/dashboard.py and alerts.py name is served by /metrics' render (names read from the two files at compile time; the coverage ones are node-exporter's and skipped); ipx's JSON lines for feed_done, download_done and feed_error carry ev, feed, new, bytes, msg and error.type, and trace_id and span_id inside a span; the directory's snapshot line carries instance, accepted and the refused_ counts. The JSON log layer is one function, otel::json_layer, for both services now. The log tests set the global subscriber, since a scoped one loses the trace ids (#408).

Tests added in b62182e: every ipx_ metric grafana/dashboard.py and alerts.py name is served by /metrics' render (names read from the two files at compile time; the coverage ones are node-exporter's and skipped); ipx's JSON lines for feed_done, download_done and feed_error carry ev, feed, new, bytes, msg and error.type, and trace_id and span_id inside a span; the directory's snapshot line carries instance, accepted and the refused_ counts. The JSON log layer is one function, otel::json_layer, for both services now. The log tests set the global subscriber, since a scoped one loses the trace ids (#408).
rays closed this issue 2026-11-06 20:02:29 -08:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rays/ipx#403