feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that tails the logs, ships raw lines to the hub over HTTPS with an on-disk spool, and applies enforce decisions locally. The hub keeps one node per probe (primary node = the 1.x data dir, unchanged), does all analysis and serves the UI. Peer federation is removed. 'urutau import' brings 1.x data dirs in with hash and count verification. UI: probes page, host qualified incidents, IPs never wrap, egress heatmap labels, live and replay globes no longer auto-rotate, replay repeat, live traffic metrics. BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone; log path variables move from the hub to the probe. See docs/migration-2.0.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23a7a5963a
commit
8546d14cef
130 files changed
+9396
-3311
No files matched your search
+39
-15
@@ -843,8 +843,6 @@
|
||||
if (Math.abs(this.vlon) > 0.05 || Math.abs(this.vlat) > 0.05) {
|
||||
this.lon0 += this.vlon * dt; this.lat0 = clamp(this.lat0 + this.vlat * dt, -75, 75);
|
||||
var f = Math.pow(0.04, dt); this.vlon *= f; this.vlat *= f;
|
||||
} else if (!this.reduced && this.T > this.idleAt) {
|
||||
this.lon0 += 4.5 * dt;
|
||||
}
|
||||
}
|
||||
if (still && !wasDirty && !morph) return; // nothing changed: leave the loop idle
|
||||
@@ -875,9 +873,11 @@
|
||||
'live.visits': 'Legitimate traffic',
|
||||
'live.visit': 'visit',
|
||||
'live.legend.visits': 'visits',
|
||||
'live.m.vis': 'Visits, 15 min',
|
||||
'live.m.pages': 'Pages, 15 min',
|
||||
'live.m.vis': 'Visitors, 1 h',
|
||||
'live.m.pages': 'Pages viewed, 1 h',
|
||||
'live.unit.pages': 'distinct pages',
|
||||
'live.sub.vis': '{n} requests',
|
||||
'live.sub.top': 'top: {x}',
|
||||
'live.devices': 'Devices',
|
||||
'live.vis.empty': 'anonymous',
|
||||
'live.mode': 'View',
|
||||
@@ -924,9 +924,11 @@
|
||||
'live.visits': 'Tráfego legítimo',
|
||||
'live.visit': 'visita',
|
||||
'live.legend.visits': 'visitas',
|
||||
'live.m.vis': 'Visitas, 15 min',
|
||||
'live.m.pages': 'Páginas, 15 min',
|
||||
'live.m.vis': 'Visitantes, 1 h',
|
||||
'live.m.pages': 'Páginas vistas, 1 h',
|
||||
'live.unit.pages': 'páginas distintas',
|
||||
'live.sub.vis': '{n} requisições',
|
||||
'live.sub.top': 'mais: {x}',
|
||||
'live.vis.empty': 'anônima',
|
||||
'live.devices': 'Dispositivos',
|
||||
'live.mode': 'Visualização',
|
||||
@@ -1010,7 +1012,8 @@
|
||||
if (window.matchMedia) { var mqw = matchMedia('(min-width: 1200px)'); if (mqw.addEventListener) this.listen(mqw, 'change', function () { self.placeRec(); self.map._map.resize(); }); }
|
||||
this.timers.push(setInterval(function () { self.tick(); }, 1000));
|
||||
this.timers.push(setInterval(function () { self.loadSummary(); self.loadMetrics(); }, 60000));
|
||||
this.loadSummary(); this.loadMetrics(); this.loadRecent();
|
||||
this.timers.push(setInterval(function () { self.loadTraffic(); }, 30000));
|
||||
this.loadSummary(); this.loadMetrics(); this.loadRecent(); this.loadTraffic();
|
||||
this.tick(true);
|
||||
}
|
||||
var P = Live.prototype;
|
||||
@@ -1336,7 +1339,7 @@
|
||||
|
||||
P.onVisibility = function () {
|
||||
this.hidden = document.hidden;
|
||||
if (!this.hidden) { this.loadSummary(); this.loadMetrics(); this.tick(true); }
|
||||
if (!this.hidden) { this.loadSummary(); this.loadMetrics(); this.loadTraffic(); this.tick(true); }
|
||||
};
|
||||
|
||||
P.addMore = function (n) {
|
||||
@@ -1596,14 +1599,35 @@
|
||||
for (var k in this.bk) if (+k < min - 1500) delete this.bk[k];
|
||||
};
|
||||
|
||||
// legitimate traffic: totals of the last hour from /api/v1/traffic (the server has no 15 min range),
|
||||
// refreshed every 30 s whether or not the "Legitimate traffic" toggle is on (it only controls the drawing)
|
||||
P.loadTraffic = function () {
|
||||
var self = this;
|
||||
if (!this.U.api || this.hidden) return;
|
||||
var h = this.ctx && this.ctx.host, q = { range: '1h' };
|
||||
if (h && h !== 'all') q.host = h;
|
||||
var key = q.host || 'all', p;
|
||||
try { p = this.U.api('/api/v1/traffic', q); } catch (x) { return; }
|
||||
if (!p || !p.then) return;
|
||||
p.then(function (d) {
|
||||
if (!self.alive || !d || typeof d !== 'object') return;
|
||||
var top = function (l) { return Array.isArray(l) && l[0] && l[0].key ? l[0] : null; };
|
||||
self.traf = { key: key, visitors: isNum(d.visitors) ? d.visitors : null, pages: isNum(d.pages) ? d.pages : null, requests: isNum(d.requests) ? d.requests : null, dom: top(d.domains), cc: top(d.countries) };
|
||||
self.minute = -1; self.tick(true);
|
||||
}).catch(function () { /* traffic unavailable */ });
|
||||
};
|
||||
P.visitMetrics = function (min, fmtN) {
|
||||
var vn = 0, pg = 0, vi, mm = this.mM, self = this;
|
||||
for (vi = min - 14; vi <= min; vi++) if (this.vbk[vi]) vn += this.vbk[vi].n;
|
||||
this.pathLast.forEach(function (last) { if (last >= min - 14) pg++; });
|
||||
mm.vis.val.textContent = fmtN(vn); this.setSub(mm.vis, this.t('live.legend.visits'), '');
|
||||
mm.pages.val.textContent = fmtN(pg); this.setSub(mm.pages, this.t('live.unit.pages'), '');
|
||||
this.pathLast.forEach(function (last, p) { if (last < min - 30) self.pathLast.delete(p); });
|
||||
var mm = this.mM, d = this.traf, h = this.ctx && this.ctx.host;
|
||||
if (!d || d.key !== (h && h !== 'all' ? h : 'all')) { mm.vis.val.textContent = '-'; mm.pages.val.textContent = '-'; return; }
|
||||
mm.vis.val.textContent = d.visitors === null ? '-' : fmtN(d.visitors);
|
||||
this.setSub(mm.vis, d.requests === null ? this.t('live.legend.visits') : this.t('live.sub.vis', { n: fmtN(d.requests) }), '');
|
||||
mm.pages.val.textContent = d.pages === null ? '-' : fmtN(d.pages);
|
||||
var x = d.dom ? str(d.dom.key, 40) : '';
|
||||
if (d.cc && d.cc.key) x = (x ? x + ' · ' : '') + cc2(d.cc.key);
|
||||
this.setSub(mm.pages, x ? this.t('live.sub.top', { x: x }) : this.t('live.unit.pages'), '');
|
||||
var pl = this.pathLast;
|
||||
for (var vk in this.vbk) if (+vk < min - 40) delete this.vbk[vk];
|
||||
pl.forEach(function (last, p) { if (last < min - 30) pl.delete(p); });
|
||||
};
|
||||
|
||||
P.regionName = function (cc) {
|
||||
@@ -1621,7 +1645,7 @@
|
||||
var fmtN = this.U.fmt && this.U.fmt.num ? this.U.fmt.num : String;
|
||||
var fl = this.U.fmt && this.U.fmt.flag ? this.U.fmt.flag : function () { return ''; };
|
||||
if (min !== this.minute) { this.minute = min; this.computeMetrics(min, fmtN); }
|
||||
if (this.visitsOn) this.visitMetrics(min, fmtN);
|
||||
this.visitMetrics(min, fmtN);
|
||||
// category and server counts, origins: the 15 minute window (partial minute included)
|
||||
var a = this.agg(min - 14, min, true), vis = this.agg(min - 14, min, false), c;
|
||||
CATS.forEach(function (k) {
|
||||
|
||||
Reference in new issue
Block a user