Send Tinker dedup_key with every recognised issue #44

Merged
jared merged 2 commits from feat/hwmon-dedup-key into main 2026-11-28 14:18:38 -05:00
Owner

Part 4 of #42. Stacked on #43: this branch includes its commit, so merge #43 first. The new work is commit 9f808f4.

Merging this is a deploy that needs a Tinker backfill in the same hour. See Deploy below.

What changes

Each report now sends a dedup_key (tinker_tickets#123), so Tinker stops deciding "the same problem" from the title.

Issue Key
Drive SMART / temperature drive:<serial>:smart / :temperature (no serial: host:<host>:drive_sdX:smart)
ECC host:<host>:ecc
CPU host:<host>:cpu
Network reachability host:<host>:mgmt_net_unreachable, host:<host>:ceph_net_unreachable
LXC storage lxc:<vmid>:storage:<mount>
Kernel log errors host:<host>:syslog:<error kind>
Ceph health warning cluster:ceph:<CODE>
Ceph usage / HEALTH_ERR / OSD down cluster:ceph:usage, cluster:ceph:HEALTH_ERR, cluster:ceph_osd:osd.N:down
PBS pbs:zfs:<pool>:state / usage / errors, pbs:task:<type>:failed
  • Ceph keys match Thor's (docs/contract.md in thor: cluster:ceph:<CODE>), so Thor can adopt these tickets without re-keying. The daemon reads the real health-check code from ceph health. A message-to-code table covers old titles, which only contain the message.
  • Drive keys follow the serial, not the host, so a drive moved between hosts keeps its ticket.
  • Anything unrecognised is sent without a key and keeps Tinker's title hash, so nothing new can collide.
  • OSD down stays one ticket per OSD. Thor's host:<host>:osd_down groups them per host; that change is left to Thor (#35, #40).

Backfill map

scripts/dedup_key_map.py reads hwmonDaemon's tickets from Tinker's list API (read only, any status) and parses each title. It computes the key with the same function the daemon uses, and gives each key to the newest ticket that has it, which is where Tinker's dedup points today. It writes {ticket_id: dedup_key} for Tinker's scripts/backfill_dedup_keys.php, lists anything it couldn't map, and exits 1 if there is any.

Preview on the 16 non-closed hwmonDaemon tickets, run from saved Tinker data: all 16 keyed, none unmapped.

cluster:ceph:BLUESTORE_SLOW_OP_ALERT   673679581    host:compute-storage-01:cpu      761177977
cluster:ceph:MDS_INSUFFICIENT_STANDBY  237028956    host:compute-storage-02:cpu      723331051
cluster:ceph:PG_DEGRADED               544996974    host:compute-storage-gpu-01:cpu  488693049
cluster:ceph:PG_NOT_SCRUBBED           510172934    host:micro1:cpu                  519543361
cluster:ceph:RECENT_CRASH              629475198    host:monitor-01:cpu              292553681
drive:WD-WCC4N2FYYCXP:smart            425680336    host:monitor-02:cpu              604590171
pbs:zfs:halfTbNVMeMirror:state         357934698    host:pbs:cpu                     951974331
pbs:zfs:halfTbNVMeMirror:usage         502856369    host:storage-01:cpu              101693695

I also checked the ~130 closed hwmonDaemon tickets. Two older title forms ("CPU usage is above threshold", and MDS_CLIENT_LATE_RELEASE) were added. Real titles of each form are now pinned in tests.

Deploy

Hosts run main from Gitea every hour (hwmon.service), so merging is the deploy:

  1. A few minutes past the hour, after that run finishes, merge.
  2. python3 scripts/dedup_key_map.py --out hwmon-keys.json (reads TICKET_API_KEY from /etc/hwmonDaemon/.env or the environment).
  3. On Tinker: php scripts/backfill_dedup_keys.php --map=hwmon-keys.json --dry-run, check it, then run it without --dry-run.
  4. After the next run, reports should come back as updated/deduplicated, not created. If step 3 can't happen before the hour, revert the merge.

Testing

  • pytest: 263 passed. flake8 is clean.
  • The round-trip tests are the key safeguard. For every issue type, the key the daemon sends must equal the key the mapping script recovers from the title the daemon generated. This is checked for both new [hwmon] titles and older titles without the tag. Any difference would mean a duplicate after the backfill.
  • Other tests cover:
    • real Tinker titles of every form
    • the live Ceph code taking precedence over the table
    • an unknown issue sending no key
    • every key matching Tinker's KEY_PATTERN
    • the map script: newest ticket wins, unmapped tickets reported, manual tickets ignored
  • Not run against the live API. The machine I worked on has no /etc/hwmonDaemon/.env, so the full map (including closed tickets) is first produced in step 2.

🤖 Generated with Claude Code

Part 4 of #42. **Stacked on #43**: this branch includes its commit, so merge #43 first. The new work is commit 9f808f4. **Merging this is a deploy that needs a Tinker backfill in the same hour.** See *Deploy* below. ## What changes Each report now sends a `dedup_key` (tinker_tickets#123), so Tinker stops deciding "the same problem" from the title. | Issue | Key | |---|---| | Drive SMART / temperature | `drive:<serial>:smart` / `:temperature` (no serial: `host:<host>:drive_sdX:smart`) | | ECC | `host:<host>:ecc` | | CPU | `host:<host>:cpu` | | Network reachability | `host:<host>:mgmt_net_unreachable`, `host:<host>:ceph_net_unreachable` | | LXC storage | `lxc:<vmid>:storage:<mount>` | | Kernel log errors | `host:<host>:syslog:<error kind>` | | Ceph health warning | `cluster:ceph:<CODE>` | | Ceph usage / HEALTH_ERR / OSD down | `cluster:ceph:usage`, `cluster:ceph:HEALTH_ERR`, `cluster:ceph_osd:osd.N:down` | | PBS | `pbs:zfs:<pool>:state` / `usage` / `errors`, `pbs:task:<type>:failed` | - **Ceph keys match Thor's** (`docs/contract.md` in thor: `cluster:ceph:<CODE>`), so Thor can adopt these tickets without re-keying. The daemon reads the real health-check code from `ceph health`. A message-to-code table covers old titles, which only contain the message. - **Drive keys follow the serial**, not the host, so a drive moved between hosts keeps its ticket. - **Anything unrecognised is sent without a key** and keeps Tinker's title hash, so nothing new can collide. - **OSD down stays one ticket per OSD.** Thor's `host:<host>:osd_down` groups them per host; that change is left to Thor (#35, #40). ## Backfill map `scripts/dedup_key_map.py` reads hwmonDaemon's tickets from Tinker's list API (read only, any status) and parses each title. It computes the key with **the same function the daemon uses**, and gives each key to the newest ticket that has it, which is where Tinker's dedup points today. It writes `{ticket_id: dedup_key}` for Tinker's `scripts/backfill_dedup_keys.php`, lists anything it couldn't map, and exits 1 if there is any. Preview on the 16 non-closed hwmonDaemon tickets, run from saved Tinker data: all 16 keyed, none unmapped. ``` cluster:ceph:BLUESTORE_SLOW_OP_ALERT 673679581 host:compute-storage-01:cpu 761177977 cluster:ceph:MDS_INSUFFICIENT_STANDBY 237028956 host:compute-storage-02:cpu 723331051 cluster:ceph:PG_DEGRADED 544996974 host:compute-storage-gpu-01:cpu 488693049 cluster:ceph:PG_NOT_SCRUBBED 510172934 host:micro1:cpu 519543361 cluster:ceph:RECENT_CRASH 629475198 host:monitor-01:cpu 292553681 drive:WD-WCC4N2FYYCXP:smart 425680336 host:monitor-02:cpu 604590171 pbs:zfs:halfTbNVMeMirror:state 357934698 host:pbs:cpu 951974331 pbs:zfs:halfTbNVMeMirror:usage 502856369 host:storage-01:cpu 101693695 ``` I also checked the ~130 closed hwmonDaemon tickets. Two older title forms ("CPU usage **is** above threshold", and `MDS_CLIENT_LATE_RELEASE`) were added. Real titles of each form are now pinned in tests. ## Deploy Hosts run `main` from Gitea every hour (`hwmon.service`), so merging is the deploy: 1. A few minutes past the hour, after that run finishes, merge. 2. `python3 scripts/dedup_key_map.py --out hwmon-keys.json` (reads `TICKET_API_KEY` from `/etc/hwmonDaemon/.env` or the environment). 3. On Tinker: `php scripts/backfill_dedup_keys.php --map=hwmon-keys.json --dry-run`, check it, then run it without `--dry-run`. 4. After the next run, reports should come back as `updated`/`deduplicated`, not `created`. If step 3 can't happen before the hour, revert the merge. ## Testing - `pytest`: 263 passed. `flake8` is clean. - The round-trip tests are the key safeguard. For every issue type, the key the daemon sends must equal the key the mapping script recovers from the title the daemon generated. This is checked for both new `[hwmon]` titles and older titles without the tag. Any difference would mean a duplicate after the backfill. - Other tests cover: - real Tinker titles of every form - the live Ceph code taking precedence over the table - an unknown issue sending no key - every key matching Tinker's `KEY_PATTERN` - the map script: newest ticket wins, unmapped tickets reported, manual tickets ignored - **Not run against the live API.** The machine I worked on has no `/etc/hwmonDaemon/.env`, so the full map (including closed tickets) is first produced in step 2. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 2 commits 2026-11-28 14:05:43 -05:00
feat: tag tickets [hwmon] and add per-check ticket switches (#42)
Security / Python Security (bandit) (push) Successful in 2m2s
Lint / Python (flake8) (push) Successful in 2m2s
Lint / Notify on failure (push) Skipped
Test / Python Tests (pytest) (push) Successful in 1m16s
Lint / Python (flake8) (pull_request) Successful in 1m18s
Lint / Notify on failure (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 58s
Test / Python Tests (pytest) (pull_request) Successful in 1m5s
50c7e427d9
Part 1 of #42: titles now carry the reporting app,
[source][auto][hwmon][area] Summary [scope][env][type], and descriptions end
with a footer naming hwmonDaemon and the host. Checked against Tinker's
TicketHash.php: the tag matches no category keyword, isn't an environment
tag, and network keys already strip bracketed tags, so no existing ticket is
re-keyed. Tinker updates the title of an open duplicate silently.

Part 5 of #42: CPU_ENABLED, LXC_STORAGE_ENABLED and NETWORK_ENABLED in
/etc/hwmonDaemon/.env, default on. Off means the check still runs and reports
metrics but opens no tickets and doesn't count toward P1 escalation, so each
check can be handed to thor with no gap and never two writers. An
unrecognised value logs a warning and leaves the check on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat: send Tinker dedup_key with every recognised issue (#42)
Lint / Python (flake8) (push) Successful in 57s
Lint / Notify on failure (push) Skipped
Security / Python Security (bandit) (push) Successful in 58s
Lint / Python (flake8) (pull_request) Successful in 1m3s
Lint / Notify on failure (pull_request) Skipped
Test / Python Tests (pytest) (push) Successful in 1m21s
Security / Python Security (bandit) (pull_request) Successful in 3m3s
Test / Python Tests (pytest) (pull_request) Successful in 3m36s
9f808f4e38
Part 4 of #42. Each report now carries a dedup_key (tinker_tickets#123), so
Tinker stops guessing "the same problem" from the title. Keys come from one
function, SystemHealthMonitor.dedup_key_for, which reads both raw issue
strings and the summary part of old ticket titles, so the backfill gives
existing tickets exactly the key the daemon sends.

- Ceph health warnings use the real health-check code (cluster:ceph:<CODE>),
  the key Thor uses, so Thor can adopt those tickets later. The daemon reads
  the code from `ceph health`; a message->code table covers old titles.
- Unrecognised issues are sent without a key and keep the title hash.
- scripts/dedup_key_map.py reads hwmonDaemon's tickets from Tinker (read
  only), keys the newest ticket per key, and writes the map for Tinker's
  scripts/backfill_dedup_keys.php. It reports anything it couldn't map.
- README: key table and the merge -> map -> backfill runbook.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jared added 1 commit 2026-11-28 14:10:35 -05:00
fix: give the dedup_key to the open ticket, not a newer closed one
Security / Python Security (bandit) (push) Successful in 1m3s
Lint / Python (flake8) (push) Successful in 1m5s
Lint / Notify on failure (push) Skipped
Lint / Python (flake8) (pull_request) Successful in 1m16s
Lint / Notify on failure (pull_request) Skipped
Test / Python Tests (pytest) (push) Successful in 3m47s
Security / Python Security (bandit) (pull_request) Successful in 1m10s
Test / Python Tests (pytest) (pull_request) Successful in 1m45s
e38ad5ff39
Running the map against Tinker's 140 hwmonDaemon tickets showed open ticket
357934698 (pbs ZFS DEGRADED) losing its key to a newer closed ticket for the
same pool, which would have made the next report open a duplicate. Reports
land on the open ticket today, so not-Closed now wins, then newest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jared merged commit 7b7a5f05da into main 2026-11-28 14:18:38 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/hwmonDaemon#44