Show configured metrics retention (Refs #141)
This commit is contained in:
@@ -145,6 +145,8 @@ export interface AutoscalingMetrics {
|
||||
|
||||
export interface MetricsData {
|
||||
days: MetricsDays;
|
||||
/** Configured occupancy history retention; zero keeps samples indefinitely. */
|
||||
metricsKeepDays: number;
|
||||
since: number;
|
||||
now: number;
|
||||
/** Retained sample timestamps describe collection, not gameplay freshness. */
|
||||
|
||||
@@ -507,6 +507,7 @@ export function readMetrics(input: MetricsDays | MetricsQuery, now = Date.now())
|
||||
};
|
||||
return {
|
||||
days,
|
||||
metricsKeepDays: fleetSettings().metricsKeepDays,
|
||||
since,
|
||||
now,
|
||||
...metadata,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { parentPort } from 'node:worker_threads';
|
||||
import { db } from '../db/index.js';
|
||||
import { fleetSettings } from '../settings.js';
|
||||
import { readMetrics } from '../fleet/metrics.js';
|
||||
import { getLeaderboard, getPlayerLeaderboardEntry } from '../fleet/leaderboard.js';
|
||||
import { getPlayerProfile } from '../fleet/player-profile.js';
|
||||
@@ -28,6 +29,8 @@ parentPort!.on('message', ({ id, kind, input }) => {
|
||||
const key = JSON.stringify([
|
||||
kind,
|
||||
revision,
|
||||
// Retention edits must be visible even without new occupancy samples.
|
||||
kind === 'metrics' ? fleetSettings().metricsKeepDays : null,
|
||||
timed ? Math.floor(now / 30_000) : 0,
|
||||
timed ? input.query : input
|
||||
]);
|
||||
|
||||
@@ -44,6 +44,8 @@ function validReport(value: unknown): value is MetricsData {
|
||||
if (
|
||||
!record(value) ||
|
||||
![1, 7, 30].includes(value.days as number) ||
|
||||
!nonnegative(value.metricsKeepDays) ||
|
||||
!Number.isInteger(value.metricsKeepDays) ||
|
||||
!numeric(value.now) ||
|
||||
!numeric(value.since) ||
|
||||
!totals(value.summary) ||
|
||||
|
||||
@@ -405,9 +405,11 @@
|
||||
</p>
|
||||
<p>
|
||||
Each periodic observation covers at most {ONLINE_MAX_MS / 1000} seconds. Longer collection
|
||||
gaps are excluded. Occupancy history defaults to 31 days; saved match retention is configured
|
||||
separately. Player-hours include all players reported by the server and are estimates, not
|
||||
individual session records.
|
||||
gaps are excluded. Occupancy history is retained {report.metricsKeepDays === 0
|
||||
? 'indefinitely'
|
||||
: `for ${report.metricsKeepDays} ${report.metricsKeepDays === 1 ? 'day' : 'days'}`};
|
||||
saved match retention is configured separately. Player-hours include all players
|
||||
reported by the server and are estimates, not individual session records.
|
||||
</p>
|
||||
<p>
|
||||
Timeline buckets are aligned to UTC, with labels shown in {report.scope.timeZone.replaceAll(
|
||||
|
||||
Reference in New Issue
Block a user