Commit Graph

4 Commits

Author SHA1 Message Date
nicolargo
e52e84f354 Add a short-cut to not generate alert for some plugin (first candidate is processlist) 2026-05-23 19:44:52 +02:00
nicolargo
a720335f12 fix(v5): categorical default + drop cmd path from default view
processlist UX refinements after observing the v5 layout live:

- ``compute_level_categorical`` now returns ``None`` (was ``"ok"``) when
  the value matches no configured bucket. ``base_v5`` skips emitting
  a ``_levels`` entry in that case → the renderer keeps the DEFAULT
  colour (white/gray) instead of painting "S" / nice=0 in the OK
  green. Mirrors v4 ``get_alert`` returning ``'DEFAULT'`` for
  unmatched categorical values. The alert pipeline still sees no
  event (semantically equivalent to "ok" for alerts).

- Command rendering drops the ``/usr/bin/`` path prefix from the
  default view. Now: bold cmd + plain args only. The full-path mode
  (toggled by ``/`` in v4) is deferred to G5+ along with the rest of
  the hotkey plumbing.

Tests updated accordingly. Suite v5: 1370 green, lint clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 17:53:13 +02:00
nicolargo
80c20863d9 feat(v5): categorical thresholds + processlist VIRT/RES/IO + bold cmd
Three orthogonal improvements bundled under the processlist v5 surface:

1) Categorical thresholds (framework-level)
   - thresholds_v5 grows compute_level_categorical + read_thresholds_categorical:
     value-set membership instead of numeric comparison. Walked
     most-severe-first so misconfigured overlaps escalate to the higher
     bucket. Unmatched values return "ok" (v4 parity).
   - base_v5._compute_levels_for_item dispatches on schema flag
     ``threshold_type: "categorical"``; numeric path unchanged.
   - 8 new threshold unit tests (incl. CSV parsing, whitespace, pk-prefix).

2) processlist status + nice as categorical fields
   - status (R/W/Z/D/...) and nice (-20..19) become watched with
     ``threshold_type: "categorical"``, no defaults — operators opt in:
       [processlist]
       status_ok=R,W,P,I
       status_critical=Z,D
       nice_warning=-20,...,-1,1,...,19
     Without configuration: no _levels entry (no false positives).

3) processlist renderer: VIRT/RES + R/s/W/s + bold cmd
   - Adds VIRT (memory_info.vms) and RES (memory_info.rss) columns.
   - Adds R/s and W/s columns computed from io_counters
     ([r_new, w_new, r_old, w_old, io_tag]) / time_since_update;
     io_tag != 1 renders "?" (access denied or first cycle).
   - Status / nice cells inherit categorical _levels colour.
   - Command rendering ports v4 split_cmdline:
     /usr/bin/python3 myscript.py
       → "/usr/bin/" + **"python3"** + " myscript.py"
     Kthreads (empty cmdline) keep the [name] fallback.

v4 catalogue updated accordingly. Suite v5: 1370+30 green, lint clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 17:30:01 +02:00
nicolargo
645527de06 feat(v5): G4-processlist — port processcount + processlist plugins to v5
Last MCP gap closure. Both plugins reuse the v4 glances_processes
singleton (no engine rewrite — strategy two-phase): processcount calls
engine.update() + get_count() each cycle, processlist consumes the
pre-sorted list via get_list(). KNOWN_V5_MISSING_PLUGINS shrinks to ().

- processcount: scalar with total / running / sleeping / thread /
  pid_max; TUI mirrors v4's "TASKS N (M thr), R run, S slp, O oth"
  header.
- processlist: collection PK=pid; minimal column set CPU% / MEM% / PID /
  USER / THR / NI / S / Command, top-20 rows. cpu_percent and
  memory_percent are watched (50/70/90, prominent=False — parity fs).
- Engine-internal fields (memory_info, cpu_times, io_counters, gids,
  time_since_update, key) flagged internal=True so MCP/export keep
  them but the generic TUI skips them.
- Out of scope (deferred to G5 with args/config plumbing): extended
  view, programs aggregation, filter UI, interactive sort.

41 new tests (14 model + 27 renderer), v4 catalogue updated, MCP gap
log + adapter docstring updated.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 14:01:59 +02:00