Documentation
¶
Index ¶
Constants ¶
View Source
const ( ResourceContainer = "container" ResourceService = "service" ResourceNode = "node" )
Resource types for RuntimeEvent.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HealthInfo ¶
type HealthInfo struct {
HasHealthCheck bool
Status string // "healthy", "unhealthy", "starting", "none"
FailingStreak int
LastOutput string
}
HealthInfo holds runtime-agnostic health check information.
type RawStats ¶
type RawStats struct {
CPUPercent float64
MemUsed int64
MemLimit int64
NetRxBytes int64 // -1 if unavailable
NetTxBytes int64 // -1 if unavailable
BlockReadBytes int64 // -1 if unavailable
BlockWriteBytes int64 // -1 if unavailable
Timestamp time.Time
}
RawStats is a runtime-agnostic resource snapshot. Fields set to -1 indicate the metric is unavailable for this runtime.
type Runtime ¶
type Runtime interface {
// Lifecycle
Connect(ctx context.Context) error
IsConnected() bool
SetDisconnected()
Close() error
// Identity
Name() string // "docker" or "kubernetes"
// Discovery
DiscoverAll(ctx context.Context) ([]*container.Container, error)
// Events
StreamEvents(ctx context.Context) <-chan RuntimeEvent
// Stats
StatsSnapshot(ctx context.Context, externalID string) (*RawStats, error)
// Logs
FetchLogs(ctx context.Context, externalID string, lines int, timestamps bool) ([]string, error)
StreamLogs(ctx context.Context, externalID string, lines int, timestamps bool) (io.ReadCloser, error)
// Health
GetHealthInfo(ctx context.Context, externalID string) (*HealthInfo, error)
}
Runtime abstracts the container orchestration platform. Implementations: docker.Runtime, kubernetes.Runtime.
type RuntimeEvent ¶
type RuntimeEvent struct {
Action string
ExternalID string
Name string
ExitCode string
HealthStatus string
ErrorDetail string
ResourceType string // "container", "service", or "node"
Timestamp time.Time
Labels map[string]string
}
RuntimeEvent is a normalized state change from any runtime.
Click to show internal directories.
Click to hide internal directories.