feat(hub): app telemetry analytics dashboard (v0.4.0)
- store/telemetry.go: new app_telemetry + app_log_issues tables with
SaveAppTelemetry, GetFleetAppSummary (with P95), GetAppTelemetryHistory,
GetAppCustomerBreakdown, GetCustomerAppSummary, GetAppIssues, prune methods
- api/handler.go: parse and save optional app_telemetry from report body,
backward-compatible with old controllers
- cmd/hub/main.go: prune app_telemetry (90d) and stale issues (30d)
- web/apps.go: handleApps + handleAppDetail + chart data aggregation helpers
- web/server.go: routes for /apps, /apps/{name}, /static/chart.min.js;
added memoryColor/accuracyClass/gt template functions
- web/embed.go: embed static/chart.min.js
- web/configs.go: add app telemetry section to handleCustomerUnified
- templates/apps.html: fleet-wide app list with summary cards and sortable table
- templates/app_detail.html: per-app page with Chart.js memory trend,
customer breakdown, and known issues table
- templates/customer_unified.html: new Alkalmazás telemetria card
- templates/style.css: badge, summary-card, chart, period-selector,
accuracy-dot, mem-color, data-table styles
- All templates: added Alkalmazások nav link
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,53 @@ func (s *Store) migrate() error {
|
||||
// v0.3.0: add channel column to notification_log (idempotent)
|
||||
s.db.Exec("ALTER TABLE notification_log ADD COLUMN channel TEXT NOT NULL DEFAULT 'customer'")
|
||||
|
||||
// v0.4.0: app telemetry tables
|
||||
_, err = s.db.Exec(`
|
||||
CREATE TABLE IF NOT EXISTS app_telemetry (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
customer_id TEXT NOT NULL,
|
||||
app_name TEXT NOT NULL,
|
||||
display_name TEXT NOT NULL DEFAULT '',
|
||||
reported_at DATETIME NOT NULL,
|
||||
memory_current_mb REAL DEFAULT 0,
|
||||
memory_avg_mb REAL DEFAULT 0,
|
||||
memory_peak_mb REAL DEFAULT 0,
|
||||
cpu_avg_percent REAL DEFAULT 0,
|
||||
catalog_estimate TEXT DEFAULT '',
|
||||
catalog_limit TEXT DEFAULT '',
|
||||
log_errors INTEGER DEFAULT 0,
|
||||
log_warnings INTEGER DEFAULT 0,
|
||||
containers_json TEXT DEFAULT '[]',
|
||||
issues_json TEXT DEFAULT '[]'
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_app_telemetry_lookup
|
||||
ON app_telemetry(app_name, reported_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_app_telemetry_customer
|
||||
ON app_telemetry(customer_id, app_name, reported_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_app_telemetry_prune
|
||||
ON app_telemetry(reported_at);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS app_log_issues (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
app_name TEXT NOT NULL,
|
||||
fingerprint TEXT NOT NULL,
|
||||
severity TEXT NOT NULL,
|
||||
message TEXT NOT NULL,
|
||||
first_seen DATETIME NOT NULL,
|
||||
last_seen DATETIME NOT NULL,
|
||||
occurrence_count INTEGER DEFAULT 1,
|
||||
affected_customers TEXT DEFAULT '[]',
|
||||
UNIQUE(app_name, fingerprint)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_app_log_issues_app
|
||||
ON app_log_issues(app_name, last_seen DESC);
|
||||
`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user