Documentation
¶
Overview ¶
Package status assembles the system status the front page shows.
It runs once a second, which is the constraint everything here is shaped by. The interesting numbers have wildly different costs — a Redis INFO is microseconds, a table-size query against a 600-million-row table is seconds — so they are gathered on separate schedules and cached between them. Fetching everything every tick would keep a database connection permanently busy answering a question nobody asked that second.
Index ¶
- Constants
- type Collector
- type CoverageAlliances
- type CoverageEntity
- type CoverageInfo
- type DatabaseInfo
- type DatabaseTableInfo
- type ESIFetchPeriod
- type ESIFetchSummary
- type ESIGroupInfo
- type ESIInfo
- type ESITokenInfo
- type ESITokenSummary
- type QueueInfo
- type RedisInfo
- type Status
- type SystemInfo
- type WalletInfo
Constants ¶
const ( QueueInterval = 5 * time.Second SlowInterval = 60 * time.Second CoverageInterval = 15 * time.Minute KillmailCoverageInterval = 10 * time.Minute )
How often each tier is refreshed. The tick is one second; everything else is served from the last value gathered.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
Pool *pgxpool.Pool
Redis *redis.Client
Cache *redis.Client
// contains filtered or unexported fields
}
Collector gathers status on tiered schedules.
Holds the cached slow values between ticks, so it is stateful and one instance must be reused across runs rather than built per tick — a fresh one would refetch everything every second, which is exactly what the tiering exists to avoid.
func NewCollector ¶
NewCollector returns a collector that reports uptime from now.
func (*Collector) Collect ¶
Collect assembles the current status.
Every individual gatherer swallows its own failure and returns nil. A status page that shows nothing because one of eight sources is unwell is worse than one that shows seven sources and a gap — and this runs every second, so a transient failure resolves itself before anybody refreshes.
type CoverageAlliances ¶
type CoverageEntity ¶
type CoverageInfo ¶
type CoverageInfo struct {
WindowDays int `json:"window_days"`
Characters CoverageEntity `json:"characters"`
Corporations CoverageEntity `json:"corporations"`
Alliances CoverageAlliances `json:"alliances"`
}
type DatabaseInfo ¶
type DatabaseInfo struct {
Size string `json:"size"`
Tables map[string]DatabaseTableInfo `json:"tables"`
}
DatabaseInfo is the expensive tier: table sizes and row estimates.
type DatabaseTableInfo ¶
type ESIFetchPeriod ¶
type ESIFetchSummary ¶
type ESIFetchSummary struct {
AllTime ESIFetchPeriod `json:"all_time"`
Last24h ESIFetchPeriod `json:"last_24h"`
}
type ESIGroupInfo ¶
type ESIInfo ¶
type ESIInfo struct {
TQStatus string `json:"tq_status"`
TQPlayers *int64 `json:"tq_players"`
ErrorBudget int64 `json:"error_budget"`
Paused bool `json:"paused"`
Groups map[string]ESIGroupInfo `json:"groups"`
}
ESIInfo is the shared rate-limit and error budget.
type ESITokenInfo ¶
type ESITokenInfo struct {
Tokens ESITokenSummary `json:"tokens"`
Fetches ESIFetchSummary `json:"fetches"`
}
type ESITokenSummary ¶
type QueueInfo ¶
type QueueInfo struct {
Waiting int64 `json:"waiting"`
Active int64 `json:"active"`
Delayed int64 `json:"delayed"`
Failed int64 `json:"failed"`
}
QueueInfo maps River states to the BullMQ-shaped contract the frontend consumes.
type RedisInfo ¶
type RedisInfo struct {
Version string `json:"version"`
UptimeSeconds int64 `json:"uptime_seconds"`
ConnectedClients int64 `json:"connected_clients"`
UsedMemory string `json:"used_memory"`
TotalCommandsProcessed int64 `json:"total_commands_processed"`
KeyspaceHits int64 `json:"keyspace_hits"`
KeyspaceMisses int64 `json:"keyspace_misses"`
}
RedisInfo is one instance's INFO.
type Status ¶
type Status struct {
Event string `json:"event"`
Uptime int64 `json:"uptime"`
StartedAt string `json:"started_at"`
Timestamp string `json:"timestamp"`
System SystemInfo `json:"system"`
Database *DatabaseInfo `json:"database"`
Queues map[string]QueueInfo `json:"queues"`
ESI *ESIInfo `json:"esi"`
Redis *RedisInfo `json:"redis"`
Cache *RedisInfo `json:"redis_cache"`
ZkbIngest *zkb.IngestStats `json:"zkb_ingest"`
Coverage *CoverageInfo `json:"coverage"`
ESITokens *ESITokenInfo `json:"esi_tokens"`
Wallet *WalletInfo `json:"wallet"`
// External HTTP-derived panels are intentionally deferred. Explicitly null
// rather than absent, so the status page renders them as unknown.
ImageServer any `json:"image_server"`
WebSocket any `json:"websocket"`
Cloudflare any `json:"cloudflare"`
}
Status is the published payload.
Optional sources are pointers left nil rather than omitted, so the shape stays stable and a consumer can tell "not collected" from "collected as zero".
type SystemInfo ¶
type SystemInfo struct {
Platform string `json:"platform"`
Arch string `json:"arch"`
CPUs int `json:"cpus"`
MemoryTotal string `json:"memory_total"`
MemoryFree string `json:"memory_free"`
LoadAverage []float64 `json:"load_average"`
}
SystemInfo describes the host.