hub 0.169.0 (unreleased, not built): the upload watch's four events — allowed, operator-only, per-app cooldown, one readable Watch line in the operator mail
gates / gates (push) Successful in 12m47s

app_unexplained_upload / app_unexplained_cpu (warning) and their _cleared (info), from controller v0.342.0 (08 section 9,
operator ruling 2026-10-23). Red-proved: operator-only, the render line, the allow-list.
This commit is contained in:
admin committed 2026-10-23 21:26:36 +02:00
1 parent 5277d859d5
commit af5c005a4e
7 files changed
+140 -2

No files matched your search

+38
View File
@@ -70,6 +70,13 @@ Message: %s`, customerID, eventType, severity, now, message)
}
}
// The upload and CPU watch (v0.169.0): what the app sent or burnt, what it said it did, and for how long.
if eventType == "app_unexplained_upload" || eventType == "app_unexplained_cpu" {
if line, ok := renderUnexplained(detailsJSON); ok {
body += "\n" + line
}
}
if detailsJSON != "" && detailsJSON != "{}" {
body += fmt.Sprintf("\nDetails: %s", detailsJSON)
}
@@ -432,6 +439,37 @@ func stackNameOf(detailsJSON string) string {
return d.StackName
}
// renderUnexplained is the upload watch's operator line (v0.169.0, controller upwatch.Details).
func renderUnexplained(detailsJSON string) (string, bool) {
var d struct {
App string `json:"app"`
Kind string `json:"kind"`
Minutes int `json:"minutes"`
RateMbps float64 `json:"rate_mbps"`
AppMbps float64 `json:"app_mbps"`
CPUPercent float64 `json:"cpu_percent"`
Explainer string `json:"explainer"`
Viewers int `json:"viewers"`
Transcodes int `json:"transcodes"`
LineMbps float64 `json:"line_mbps"`
}
if json.Unmarshal([]byte(detailsJSON), &d) != nil || d.App == "" {
return "", false
}
if d.Kind == "cpu" {
return fmt.Sprintf("Watch: %s — %.0f%% CPU (of one core) for %d min; asked: %s, transcodes %d", d.App, d.CPUPercent, d.Minutes, d.Explainer, d.Transcodes), true
}
said := "no app number to compare"
if d.AppMbps >= 0 {
said = fmt.Sprintf("the app counted %.1f Mbit/s", d.AppMbps)
}
line := fmt.Sprintf("Watch: %s — upload %.1f Mbit/s for %d min; %s (asked: %s, viewers %d)", d.App, d.RateMbps, d.Minutes, said, d.Explainer, d.Viewers)
if d.LineMbps > 0 {
line += fmt.Sprintf("; the box's line: at least %.0f Mbit/s", d.LineMbps)
}
return line, true
}
// renderAppRepair is app_repaired_after_crash's operator line (R-1007): the counts, the boot and the duration.
func renderAppRepair(detailsJSON string) (string, bool) {
var d struct {