CI / Lint (flake8, house style) (pull_request) Successful in 56s
CI / Test (pytest) (pull_request) Successful in 53s
CI / Security (bandit, pip-audit) (pull_request) Successful in 1m8s
CI / Integration (MariaDB) (pull_request) Successful in 1m49s
CI / UI (screenshots) (pull_request) Failing after 1m7s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m58s
CI / Deploy (pull_request) Skipped
- thor/web/api.py: /api/incidents/covering (thor#1 pre-check), /api/incidents, /api/incident/<key>, machine keys by SHA-256 with optional source CIDRs, like Gandalf's (gandalf#68); 503 when the database is away so callers fail open. covered=true only when there is a ticket to comment on; shadow incidents are listed but never cover. - thor/web/ui.py + templates: Needs attention (incidents, Thor itself, timeline-only, known conditions seen again, unexplained symptoms), incident page (what happened, also seen, what Thor sent or would have sent, ticket text), known conditions. Read-only; CSP with nonces; Authelia identity shown only when it comes from NPM. Mobile nav drawer. - web_template v1.2 (8286bb2) vendored and checked against upstream in CI. - docs/contract.md: the /covering contract for the Gandalf and hwmonDaemon sessions. - scripts/ui_demo.py + scripts/screenshots.py, and a CI job that renders every page with replay data (desktop, mobile, dark, light) and uploads the screenshots. - Fix: systemd-escaped cpusets (system-ceph\x2dosd.slice) were not recognised as Ceph; four of the 11-23 kills came from the OSD slice. Found while reviewing the screenshots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
3.8 KiB
Markdown
77 lines
3.8 KiB
Markdown
# Thor's side of the ticket contract
|
|
|
|
How Gandalf and hwmonDaemon ask Thor whether something is already covered, before they open
|
|
a host-, cluster- or source-level ticket. The contract itself is in the plan on
|
|
[thor#1](https://code.lotusguild.org/LotusGuild/thor/issues/1); the callers' side is gandalf#66
|
|
and hwmonDaemon#42.
|
|
|
|
## The rules in short
|
|
- Each app tickets only its own evidence domain. The root cause owns the ticket, whichever app
|
|
found it; symptoms are "Also seen" comments. Thor is the only correlator.
|
|
- Before opening a host-, cluster- or source-level ticket, ask Thor. If Thor says **covered**,
|
|
comment on the ticket it names instead. If Thor doesn't answer, answers an error, or is slow
|
|
(use a short timeout, 3 to 5 s), **open your ticket as normal**. Fail open: never lose a ticket.
|
|
- Nobody closes tickets automatically.
|
|
|
|
## Request
|
|
```
|
|
GET http://10.10.10.86/api/incidents/covering?host=<host>
|
|
GET http://10.10.10.86/api/incidents/covering?scope=cluster
|
|
GET http://10.10.10.86/api/incidents/covering?scope=source:prometheus
|
|
Authorization: Bearer <your app's key>
|
|
```
|
|
- Call the CT directly (10.10.10.86), not `thor.lotusguild.org`, which is behind Authelia.
|
|
- `host` accepts current names and old ones (`large1`, `micro1`).
|
|
- Keys: give Thor's operator the SHA-256 of your key. It goes in `/etc/thor/thor.json`:
|
|
`"api_keys": [{"name": "gandalf", "sha256": "<hex>", "scopes": ["read"], "sources": ["10.10.10.61/32"]}]`.
|
|
A wrong or unknown key is a 401, even with identity headers. Only `GET` is allowed.
|
|
|
|
## Response
|
|
```json
|
|
{
|
|
"covered": true,
|
|
"ticket_id": "987654321",
|
|
"host": "compute-storage-02",
|
|
"scope": null,
|
|
"incidents": [
|
|
{"key": "cluster:corosync:partition", "kind": "partition", "subject": "cluster", "state": "open",
|
|
"priority": 1, "summary": "Cluster partition: ...", "mode": "live", "ticket_id": "987654321",
|
|
"first_seen": 1793825481.9, "last_seen": 1793825662.0,
|
|
"url": "https://thor.lotusguild.org/incident/cluster:corosync:partition"}
|
|
],
|
|
"known_conditions": [
|
|
{"kind": "reboot", "subject": "compute-storage-02", "ticket_id": "693930698",
|
|
"reason": "compute-storage-02 reboots every 2 to 3 days from a failing DIMM ..."}
|
|
]
|
|
}
|
|
```
|
|
- **`covered`** is true only when there is a ticket you can comment on: an incident with a live
|
|
ticket, or a known condition with a tracking ticket. **`ticket_id`** is that ticket.
|
|
- While a Thor check runs in **shadow** (all of phase 1), its incidents are listed with
|
|
`"mode": "shadow"` and `"ticket_id": null`, and they do **not** make `covered` true: there is
|
|
nothing in Tinker to comment on, so open your own ticket. Logging the shadow incident's key
|
|
next to your ticket helps the comparison before Thor goes live.
|
|
- Timeline-only incidents (planned maintenance from Gandalf) never appear here.
|
|
- Times are unix seconds (UTC).
|
|
- Errors: `400` (no `host` or `scope`), `401` (key), `503` (Thor can't read its database).
|
|
Treat every error as "not covered".
|
|
|
|
## What counts as covering what
|
|
| Ask | Matches |
|
|
|---|---|
|
|
| `host=X` | active incidents about X, and active cluster-wide incidents |
|
|
| `scope=cluster` | active cluster-wide incidents, and incidents on hosts that run Ceph OSDs |
|
|
| `scope=source:prometheus` | an active "monitoring source down" incident for that source |
|
|
|
|
## Incident keys (`dedup_key` in Tinker, tinker_tickets#123)
|
|
`scope:subject:kind`, chosen by the app that owns the ticket. Thor's:
|
|
|
|
| Key | Meaning |
|
|
|---|---|
|
|
| `host:<host>:oom` | host out of memory (global OOM kills) |
|
|
| `host:<host>:reboot` | unexpected reboot (thor#4) |
|
|
| `host:<host>:fenced` | host lost its cluster link and was fenced |
|
|
| `cluster:corosync:partition` | two or more nodes fenced or out of quorum |
|
|
| `cluster:reboots:<n>` | several hosts rebooted together with nothing else explaining it |
|
|
| `maintenance:gandalf:<id>` | a Gandalf maintenance (timeline only, never a ticket) |
|