Documentation ¶
Index ¶
Constants ¶
View Source
const ( B ByteSize = 1 KB = B << 10 MB = KB << 10 GB = MB << 10 TB = GB << 10 PB = TB << 10 EB = PB << 10 )
Constants for ByteSize.
Variables ¶
View Source
var Gatherer gatherer = &SystemGatherer{}
Gatherer is the interface to collect metrics, which can be changed to mock in tests.
Functions ¶
This section is empty.
Types ¶
type ByteSize ¶
type ByteSize uint64
ByteSize represents a size in bytes.
type ContainerStatsJSON ¶
type ContainerStatsJSON struct { Name string `json:"name"` ID string `json:"id"` MemoryUsed uint64 `json:"memory_used"` MemoryAvailable uint64 `json:"memory_available"` MemoryUsage float64 `json:"memory_usage"` // percentage CPUCount int `json:"cpu_count"` CPUDelta uint64 `json:"cpu_delta"` CPUSystemDelta uint64 `json:"cpu_system_delta"` CPUUsage float64 `json:"cpu_usage"` // percentage }
type Metrics ¶
type Metrics struct { SystemMetrics *SystemMetrics `json:"system_metrics"` ContainersMetrics []*ContainerStatsJSON `json:"containers_metrics"` }
Metrics holds the metrics about docker and the system.
type SystemGatherer ¶
type SystemGatherer struct{}
SystemGatherer collects metrics
func (*SystemGatherer) Gather ¶
func (s *SystemGatherer) Gather() (*Metrics, error)
Gather gathers metrics from docker and the system.
type SystemMetrics ¶
type SystemMetrics struct { Uptime time.Duration `json:"uptime"` MemoryTotal ByteSize `json:"memory_total"` MemoryUsed ByteSize `json:"memory_used"` MemoryFree ByteSize `json:"memory_free"` CPUCount int `json:"cpu_count"` CPUUser float64 `json:"cpu_user"` CPUSystem float64 `json:"cpu_system"` CPUIdle float64 `json:"cpu_idle"` }
SystemMetrics holds the metrics about the system.
type TestGatherer ¶
type TestGatherer struct {
Metrics *Metrics
}
TestGatherer is a mock gatherer for tests.
func (TestGatherer) Gather ¶
func (t TestGatherer) Gather() (*Metrics, error)
Gather returns the metrics set while testing.
Click to show internal directories.
Click to hide internal directories.