Files
run/protocol/metrics.go
T
2026-08-26 09:56:43 +08:00

32 lines
1.1 KiB
Go

package protocol
import "time"
type MetricSample struct {
ID string `json:"id,omitempty"`
ServerInstanceID string `json:"serverInstanceId"`
Online bool `json:"online"`
PlayerCount *int `json:"playerCount,omitempty"`
MaxPlayers *int `json:"maxPlayers,omitempty"`
TPS *float64 `json:"tps,omitempty"`
LatencyMS *float64 `json:"latencyMs,omitempty"`
CPUPercent *float64 `json:"cpuPercent,omitempty"`
MemoryPercent *float64 `json:"memoryPercent,omitempty"`
DiskPercent *float64 `json:"diskPercent,omitempty"`
Source string `json:"source"`
CollectedAt time.Time `json:"collectedAt"`
}
type MetricBatchIngestRequest struct {
RunEndpointID string `json:"runEndpointId"`
SessionToken string `json:"sessionToken"`
Samples []MetricSample `json:"samples"`
}
type MetricBatchIngestResponse struct {
Accepted bool `json:"accepted"`
AcceptedCount int `json:"acceptedCount"`
LatestAt time.Time `json:"latestAt"`
ServerTime time.Time `json:"serverTime"`
}