This document provides the complete schema documentation for PTR (Public Test Realm) stats files, enabling strategic planning agents and automation systems to consume telemetry data for performance validation and analysis.
Overview
PTR stats collection provides comprehensive telemetry data for:
Performance validation - Validate optimization impact before production
Trend analysis - Track 7-day and 30-day performance trends
interfacePTRStats { metadata: { /** ISO 8601 timestamp when stats were collected */ collectedAt: string; /** Data source: "stats_api", "console", or "none" */ source: "stats_api" | "console" | "none"; /** Whether collection succeeded */ success: boolean; /** Error message if collection failed */ error?: string; /** Whether console fallback was activated */ fallbackActivated: boolean; /** List of shards where bot has rooms */ shards?: string[]; /** Total rooms across all shards */ totalRooms?: number; }; /** Aggregated stats by shard name */ stats: Record<string, ShardStats> | null; /** Per-shard collection details */ shardStats?: ShardStatsEntry[]; /** Raw data if no processed stats available */ raw?: unknown; }
interfaceShardStats { latest: { /** Game tick when stats were recorded */ time: number; cpu: { /** CPU used in the tick (ms) */ used: number; /** CPU limit for the tick */ limit: number; /** Current CPU bucket level (0-10000) */ bucket: number; }; creeps: { /** Total creep count */ count: number; /** Creeps by role name */ byRole?: Record<string, number>; }; rooms: { /** Number of controlled rooms */ count: number; /** Per-room stats indexed by room name */ [roomName: string]: RoomStats | number; }; memory?: { /** Memory usage in bytes */ used: number; }; structures?: { containers?: number; roads?: number; towers?: number; extensions?: number; spawns?: number; }; spawns?: number; activeSpawns?: number; health?: { score: number; state: string; workforce: number; energy: number; spawn: number; infrastructure: number; warningCount: number; recoveryMode: string; }; }; }
interfaceRoomStats { /** Energy available for spawning */ energyAvailable: number; /** Maximum energy capacity */ energyCapacityAvailable: number; /** Room Control Level (1-8) */ controllerLevel: number; /** Progress points toward next RCL */ controllerProgress: number; /** Total points required for next RCL */ controllerProgressTotal: number; }
interfaceProfilerSnapshot { /** ISO 8601 timestamp when data was fetched */ fetchedAt: string; /** Data source identifier */ source: string; /** Whether profiler is currently running */ isEnabled: boolean; /** Whether profiler has collected data */ hasData: boolean; /** Raw profiler memory if available */ profilerMemory?: ProfilerMemory; /** Calculated summary if data available */ summary?: ProfilerSummary; /** Error message if collection failed */ error?: string; }
interfaceProfilerSummary { /** Total ticks profiled */ totalTicks: number; /** Number of functions profiled */ totalFunctions: number; /** Average CPU used per tick */ averageCpuPerTick: number; /** Top CPU consumers sorted by usage */ topCpuConsumers: FunctionProfile[]; }
interfaceFunctionProfile { /** Function name */ name: string; /** Total call count */ calls: number; /** Average CPU per call */ cpuPerCall: number; /** Average calls per tick */ callsPerTick: number; /** Average CPU per tick for this function */ cpuPerTick: number; /** Percentage of total CPU */ percentOfTotal: number; }
Regression Detection Thresholds
The historical trend analysis uses these thresholds to detect regressions:
When alerts are detected, the system can create GitHub issues:
1 2 3 4
if (trends.alerts.some(a => a.severity === "critical")) { // Create issue for critical regression // Include affected metrics, recommendations, and links to profiler data }