feat(telemetry): rollups, alerts, scheduler, health checks, admin server fns
- pure rollup accumulators with tests; daily upserts keyed date/metric/dim - alert checks with db-backed cooldown and push to admin players - in-process scheduler started from health probes - health endpoint checks pb + supertokens, stale-while-revalidate, always 200 - sse connection counter moved to emitter - telemetry feature server fns: events/errors/groups/rollups/alerts/status
This commit is contained in:
@@ -68,6 +68,20 @@ export const emitServerEvent = (event: ServerEvent) => {
|
||||
serverEvents.emit(event.type, event);
|
||||
};
|
||||
|
||||
let activeConnections = 0;
|
||||
|
||||
export const incrementConnections = () => {
|
||||
activeConnections++;
|
||||
return activeConnections;
|
||||
};
|
||||
|
||||
export const decrementConnections = () => {
|
||||
activeConnections = Math.max(0, activeConnections - 1);
|
||||
return activeConnections;
|
||||
};
|
||||
|
||||
export const getActiveConnectionCount = () => activeConnections;
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
setInterval(() => {
|
||||
const listenerCounts = Object.fromEntries(
|
||||
|
||||
Reference in New Issue
Block a user