Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

feat(stats): total renders, total installs and a growth chart on the fleet page

mrbizarro0d3ea8d1a478
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 82fcd39..8659468 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -13099,6 +13099,11 @@ def _usage_local_report() -> dict:
refused_7d = 0
active_7d = False
+ total_renders = 0
+ renders_by_day: dict[str, int] = {}
+ first_boot_ts = None
+ d30 = now - 30 * 86400
+
for rec in recs:
try:
ts = float(rec.get("ts") or 0)
@@ -13109,6 +13114,8 @@ def _usage_local_report() -> dict:
if ts >= d7:
active_7d = True
if ev == "app_boot":
+ if first_boot_ts is None or ts < first_boot_ts:
+ first_boot_ts = ts
if ts >= d14:
day = time.strftime("%Y-%m-%d", time.localtime(ts))
boots_by_day[day] = boots_by_day.get(day, 0) + 1
@@ -13119,6 +13126,11 @@ def _usage_local_report() -> dict:
ram_key = str(props.get("ram_gb") or "unknown")
rams[ram_key] = rams.get(ram_key, 0) + 1
elif ev in ("render_completed", "render_failed"):
+ if ev == "render_completed":
+ total_renders += 1
+ if ts >= d30:
+ day = time.strftime("%Y-%m-%d", time.localtime(ts))
+ renders_by_day[day] = renders_by_day.get(day, 0) + 1
if ts >= d7:
renders_7d += 1
if ts >= d14:
@@ -13164,12 +13176,18 @@ def _usage_local_report() -> dict:
"for fleet data"),
"tiles": {
"weekly_active_installs": 1 if active_7d else 0,
+ "total_renders": total_renders,
+ "total_installs": 1 if first_boot_ts else 0,
"renders_7d": renders_7d,
"h3_share_pct": round(100.0 * h3_14d / tot_14d, 1) if tot_14d else None,
"error_rate_pct": (round(100.0 * fail_14d / (ok_14d + fail_14d), 1)
if (ok_14d + fail_14d) else None),
"refusals_7d": refused_7d,
},
+ "growth": _usage_growth_block(
+ [(time.strftime("%Y-%m-%d", time.localtime(first_boot_ts)), 1)] if first_boot_ts else [],
+ [(d, renders_by_day[d]) for d in sorted(renders_by_day)],
+ []),
"boots_by_day": [{"date": d, "count": boots_by_day[d]}
for d in sorted(boots_by_day)],
"engines": _usage_rank(engines, "engine", 8),
@@ -13239,9 +13257,48 @@ _USAGE_FLEET_QUERIES = {
"properties['to'] AS now_, count() AS c FROM events "
"WHERE event = 'pack_state_change' AND timestamp > now() - INTERVAL 7 DAY "
"GROUP BY pack, was, now_ ORDER BY c DESC",
+ # ---- Growth (2026-09-06). All-time, no window: the numbers the owner
+ # asks for first ("how many renders have we done") and the curves that
+ # say whether the app is growing. An install is a distinct_id, and it is
+ # NEW on the day of its first boot — app_installed fires once per
+ # install but only since it existed, so first-boot is the honest date.
+ "total_renders":
+ "SELECT count() FROM events WHERE event = 'render_completed'",
+ "total_installs":
+ "SELECT count(DISTINCT distinct_id) FROM events WHERE event = 'app_boot'",
+ "installs_by_day":
+ "SELECT d, count() AS c FROM (SELECT distinct_id, toDate(min(timestamp)) AS d "
+ "FROM events WHERE event = 'app_boot' GROUP BY distinct_id) "
+ "GROUP BY d ORDER BY d",
+ "renders_by_day":
+ "SELECT toDate(timestamp) AS d, count() AS c FROM events "
+ "WHERE event = 'render_completed' AND timestamp > now() - INTERVAL 30 DAY "
+ "GROUP BY d ORDER BY d",
+ "active_by_week":
+ "SELECT toStartOfWeek(timestamp) AS w, count(DISTINCT distinct_id) AS c "
+ "FROM events WHERE event = 'app_boot' AND timestamp > now() - INTERVAL 12 WEEK "
+ "GROUP BY w ORDER BY w",
}
+def _usage_growth_block(installs_by_day: list, renders_by_day: list,
+ active_by_week: list) -> dict:
+ """The dashboard's growth series, one shape for fleet and local.
+
+ installs_by_day carries the cumulative count alongside the day's new
+ installs so the page draws the curve without re-summing; the last
+ cumulative value equals total installs by construction."""
+ inst, running = [], 0
+ for d, c in installs_by_day:
+ running += int(c)
+ inst.append({"date": str(d), "new": int(c), "cumulative": running})
+ return {
+ "installs_by_day": inst,
+ "renders_by_day": [{"date": str(d), "count": int(c)} for d, c in renders_by_day],
+ "active_by_week": [{"week": str(w), "installs": int(c)} for w, c in active_by_week],
+ }
+
+
def _usage_fleet_query_one(hogql: str, key: str) -> list:
"""Run one HogQL query. Returns the `results` rows, or [] on any error.
@@ -13332,6 +13389,8 @@ def _usage_fleet_report() -> dict | None:
"tiles": {
"weekly_active_installs": _scalar("wau"),
"daily_active_installs": _scalar("dau"),
+ "total_renders": _scalar("total_renders"),
+ "total_installs": _scalar("total_installs"),
"renders_7d": ok_n + fail_n,
"h3_share_pct": round(100.0 * h3 / tot, 1) if tot else None,
"error_rate_pct": (round(100.0 * fail_n / (ok_n + fail_n), 1)
@@ -13340,6 +13399,13 @@ def _usage_fleet_report() -> dict | None:
# aggregator's render_refused branch for why.
"refusals_7d": sum(r["count"] for r in refusals),
},
+ "growth": _usage_growth_block(
+ [(r[0], r[1]) for r in (res.get("installs_by_day") or [])
+ if isinstance(r, (list, tuple)) and len(r) >= 2],
+ [(r[0], r[1]) for r in (res.get("renders_by_day") or [])
+ if isinstance(r, (list, tuple)) and len(r) >= 2],
+ [(r[0], r[1]) for r in (res.get("active_by_week") or [])
+ if isinstance(r, (list, tuple)) and len(r) >= 2]),
"boots_by_day": [{"date": str(r[0]), "count": int(r[1])}
for r in (res.get("boots_by_day") or [])
if isinstance(r, (list, tuple)) and len(r) >= 2],
diff --git a/panel_assets/stats.html b/panel_assets/stats.html
index af4c508..543e891 100644
--- a/panel_assets/stats.html
+++ b/panel_assets/stats.html
@@ -964,6 +964,15 @@
<span id="usage-note-text">loading…</span>
</div>
<div class="kpi-grid" id="usage-tiles" aria-label="Usage headline stats"></div>
+ <!-- Growth: installs over time (cumulative, all-time) against renders
+ per day (30d). One chart, two axes, so "is it growing" is one
+ glance; weekly active installs ride the caption. -->
+ <div class="usage-growth" id="usage-growth" hidden>
+ <h3>Growth <span class="h2-sub" id="usage-growth-sub">installs, all time · renders per day, 30d</span></h3>
+ <div class="chart-wrap" style="height:260px">
+ <canvas id="chart-usage-growth" aria-label="Installs over time and renders per day"></canvas>
+ </div>
+ </div>
<!-- Pack-flip alert. A pack going true→false across boots is the
"my H3 vanished" bug class; red when it has happened at all. -->
<div class="usage-alert is-clear" id="usage-packflip">
@@ -2586,11 +2595,20 @@
// Headline tiles. Null values render as "—" rather than 0 so
// "we have no data" never masquerades as "the number is zero".
const t = u.tiles || {};
+ // "All time" is since the first install that ever pinged — the fleet
+ // has a first day and the tile says which, so the number is not read
+ // as "since the app existed".
+ const firstDay = (((u.growth || {}).installs_by_day || [])[0] || {}).date;
+ const since = firstDay ? 'since ' + firstDay : 'all time';
const tiles = [
+ { label: 'Total renders', value: fmt(t.total_renders),
+ sub: isFleet ? 'completed · all installs · ' + since : 'completed · this machine · ' + since, hero: true },
+ { label: isFleet ? 'Total installs' : 'Installs',
+ value: fmt(t.total_installs), sub: isFleet ? 'ever booted · ' + since : 'this machine' },
{ label: isFleet ? 'Weekly active installs' : 'Active this week',
value: fmt(t.weekly_active_installs),
- sub: isFleet ? 'unique installs · 7d' : 'this machine · 7d', hero: true },
- { label: 'Renders this week', value: fmt(t.renders_7d), sub: 'completed + failed · 7d' },
+ sub: isFleet ? 'unique installs · 7d' : 'this machine · 7d' },
+ { label: 'Renders', value: fmt(t.renders_7d), sub: 'completed + failed · 14d' },
{ label: 'H3 share', value: fmtPct(t.h3_share_pct), sub: 'of renders · 14d' },
{ label: 'Error rate', value: fmtPct(t.error_rate_pct), sub: 'failed renders · 14d' },
{ label: 'Refused', value: fmt(t.refusals_7d), sub: 'declined on purpose · 7d' },
@@ -2605,6 +2623,8 @@
</div>`).join('');
}
+ renderUsageGrowth(u.growth || {}, isFleet);
+
// Pack-flip alert — the H3-vanished detector. Any true→false
// transition on any pack counts; h3 is called out by name because
// it is the one that has actually bitten a user.
@@ -2637,6 +2657,61 @@
paintDist('#usage-ram', u.ram, 'ram_gb');
}
+ // Growth chart: cumulative installs (line, left axis) against renders per
+ // day (bars, right axis). Installs are all-time so the line is the shape of
+ // the whole project; renders are 30 days so the bars stay readable.
+ function renderUsageGrowth(g, isFleet) {
+ const box = $('#usage-growth');
+ const id = 'chart-usage-growth';
+ const el = document.getElementById(id);
+ if (!box || !el) return;
+ const inst = Array.isArray(g.installs_by_day) ? g.installs_by_day : [];
+ const rend = Array.isArray(g.renders_by_day) ? g.renders_by_day : [];
+ const weeks = Array.isArray(g.active_by_week) ? g.active_by_week : [];
+ if (!inst.length && !rend.length) { box.hidden = true; return; }
+ box.hidden = false;
+ destroyChart(id);
+ // One date axis: the union of both series, cumulative installs carried
+ // forward across days with no new install.
+ const dates = [...new Set([...inst.map(p => p.date), ...rend.map(p => p.date)])].sort();
+ const cum = new Map(inst.map(p => [p.date, p.cumulative]));
+ const rmap = new Map(rend.map(p => [p.date, p.count]));
+ let last = null;
+ const instData = dates.map(d => { if (cum.has(d)) last = cum.get(d); return last; });
+ const rendData = dates.map(d => rmap.has(d) ? rmap.get(d) : null);
+ const sub = $('#usage-growth-sub');
+ if (sub) {
+ const first = weeks[0], now = weeks[weeks.length - 1];
+ const wau = (first && now && weeks.length > 1)
+ ? ` · weekly active ${fmt(first.installs)} → ${fmt(now.installs)} over ${weeks.length} weeks` : '';
+ sub.textContent = (isFleet ? 'installs, all time · renders per day, 30d' : 'this machine · renders per day, 30d') + wau;
+ }
+ charts[id] = new Chart(el.getContext('2d'), {
+ type: 'bar',
+ data: {
+ labels: dates.map(d => d.slice(5)),
+ datasets: [
+ { type: 'line', label: 'installs (cumulative)', data: instData, yAxisID: 'y',
+ borderColor: '#7c9cff', backgroundColor: 'rgba(124,156,255,.15)', fill: true,
+ tension: 0.25, pointRadius: 0, borderWidth: 2, spanGaps: true },
+ { type: 'bar', label: 'renders / day', data: rendData, yAxisID: 'y2',
+ backgroundColor: 'rgba(233,105,255,.55)', borderWidth: 0 },
+ ],
+ },
+ options: {
+ responsive: true, maintainAspectRatio: false, animation: false,
+ interaction: { mode: 'index', intersect: false },
+ plugins: { legend: { display: true, position: 'bottom' } },
+ scales: {
+ x: { ticks: { maxTicksLimit: 10, autoSkip: true }, grid: { display: false } },
+ y: { position: 'left', beginAtZero: true, title: { display: true, text: 'installs' } },
+ y2: { position: 'right', beginAtZero: true, grid: { drawOnChartArea: false },
+ title: { display: true, text: 'renders / day' } },
+ },
+ },
+ });
+ }
+
async function loadUsage(force) {
try {
const r = await fetch(USAGE_URL + (force ? '?force=1' : ''), { cache: 'no-store' });
diff --git a/test_stats_growth.py b/test_stats_growth.py
new file mode 100644
index 0000000..4b2e8e0
--- /dev/null
+++ b/test_stats_growth.py
@@ -0,0 +1,67 @@
+"""The stats page answers "how many renders, and are we growing".
+
+Total renders and total installs are ALL-TIME tiles, not windows; the growth
+block carries cumulative installs by first-boot day, renders per day (30d)
+and weekly active installs, in one shape for the fleet path and the local
+path so the page has one renderer.
+"""
+import json, time, unittest
+from unittest import mock
+
+import mlx_ltx_panel as p
+
+
+def _rec(ev, ts, **props):
+ return {"event": ev, "ts": ts, "props": props}
+
+
+class LocalGrowth(unittest.TestCase):
+ def test_totals_and_series_from_the_local_log(self):
+ now = time.time()
+ recs = [
+ _rec("app_boot", now - 40 * 86400, version="4.9.0"),
+ _rec("render_completed", now - 40 * 86400, engine="ltx"), # all-time, outside 30d
+ _rec("render_completed", now - 2 * 86400, engine="ltx"),
+ _rec("render_completed", now - 2 * 86400, engine="h3"),
+ _rec("render_failed", now - 1 * 86400, engine="ltx", error_signature="x"),
+ _rec("app_boot", now - 1 * 86400, version="4.10.5"),
+ ]
+ with mock.patch.object(p, "_usage_log_read", lambda: recs):
+ u = p._usage_local_report()
+ self.assertEqual(u["tiles"]["total_renders"], 3) # completed only, all time
+ self.assertEqual(u["tiles"]["total_installs"], 1)
+ g = u["growth"]
+ self.assertEqual(len(g["installs_by_day"]), 1)
+ self.assertEqual(g["installs_by_day"][0]["cumulative"], 1)
+ self.assertEqual(sum(r["count"] for r in g["renders_by_day"]), 2) # 30-day window
+ self.assertEqual(g["active_by_week"], [])
+
+ def test_growth_block_accumulates_installs(self):
+ g = p._usage_growth_block([("2026-08-01", 3), ("2026-08-02", 2)],
+ [("2026-08-02", 7)], [("2026-07-27", 40)])
+ self.assertEqual([r["cumulative"] for r in g["installs_by_day"]], [3, 5])
+ self.assertEqual(g["renders_by_day"], [{"date": "2026-08-02", "count": 7}])
+ self.assertEqual(g["active_by_week"], [{"week": "2026-07-27", "installs": 40}])
+
+
+class FleetQueriesAndPage(unittest.TestCase):
+ def test_fleet_queries_have_no_window_on_the_totals(self):
+ q = p._USAGE_FLEET_QUERIES
+ for name in ("total_renders", "total_installs", "installs_by_day", "renders_by_day", "active_by_week"):
+ self.assertIn(name, q)
+ self.assertNotIn("INTERVAL", q["total_renders"])
+ self.assertNotIn("INTERVAL", q["total_installs"])
+ self.assertNotIn("INTERVAL", q["installs_by_day"])
+ self.assertIn("render_completed", q["total_renders"])
+
+ def test_page_has_the_tiles_and_the_chart(self):
+ html = p.STATS_HTML_FILE.read_text(encoding="utf-8")
+ self.assertIn("Total renders", html)
+ self.assertIn("t.total_installs", html)
+ self.assertIn('id="chart-usage-growth"', html)
+ self.assertIn("function renderUsageGrowth", html)
+ self.assertIn("renderUsageGrowth(u.growth", html)
+
+
+if __name__ == "__main__":
+ unittest.main()