Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collects server metrics in the background
func NewCollector ¶
func NewCollector(store *storage.Store, dockerCli *docker.Client, sender *command.Sender, cfg *config.Config, bus *events.Bus, log *logger.Logger, collectorCfg ...CollectorConfig) *Collector
Creates a new metrics collector
func NewCollectorWithPool ¶
func NewCollectorWithPool(store *storage.Store, dockerCli *docker.Client, pool *docker.ClientPool, sender *command.Sender, cfg *config.Config, bus *events.Bus, log *logger.Logger, collectorCfg ...CollectorConfig) *Collector
NewCollectorWithPool creates a new metrics collector with a multi-node ClientPool. If pool is nil and dockerCli is non-nil, a single-node pool wrapping dockerCli is created.
func (*Collector) GetAllMetrics ¶
func (c *Collector) GetAllMetrics() map[string]*ServerMetrics
Gets a copy of all metrics
func (*Collector) GetMetrics ¶
func (c *Collector) GetMetrics(serverID string) *ServerMetrics
Get metrics for a specific server
func (*Collector) PruneStale ¶
PruneStale evicts entries not updated within maxAge (MINE-144 retention). Returns evicted count.
func (*Collector) RemoveMetrics ¶
Removes metrics for a server on delete
type CollectorConfig ¶
type CollectorConfig struct {
StatsInterval time.Duration // default 5s
RCONInterval time.Duration // default 10s
DiskInterval time.Duration // default 60s
SLPInterval time.Duration // default 15s
SLPTimeout time.Duration // default 5s
SLPEnabled bool // default true
}
Configuration for metrics collector
type ServerMetrics ¶
type ServerMetrics struct {
ServerID string
CPUPercent float64
MemoryUsage float64 // MB
DiskUsage int64 // bytes (total server data)
DiskTotal int64 // bytes
WorldSize int64 // bytes (world directory only)
PlayersOnline int
TPS float64
LastUpdated time.Time
// SLP fields
SLPAvailable bool
SLPLatencyMs int64
MOTD string
ServerVersion string
ProtocolVersion int
PlayerSample []string
MaxPlayers int
Favicon string // Base64 PNG (data:image/png;base64,...)
SLPLastUpdated time.Time
}
Click to show internal directories.
Click to hide internal directories.