biz

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package biz provides business-value metrics from system raw metrics

Index

Constants

This section is empty.

Variables

View Source
var ErrExitedContainerExpired = errors.New("container exited TTL expired")
View Source
var ErrExitedContainerUnexpired = errors.New("exited containers have no metrics to fetch")

Functions

This section is empty.

Types

type BlkIO

type BlkIO struct {
	TotalReadCount  float64
	TotalWriteCount float64
	TotalReadBytes  float64
	TotalWriteBytes float64
}

BlkIO stands for Block I/O stats

type CPU

type CPU struct {
	CPUPercent       float64
	KernelPercent    float64
	UserPercent      float64
	UsedCores        float64
	LimitCores       float64
	UsedCoresPercent float64
	ThrottlePeriods  uint64
	ThrottledTimeMS  float64
	Shares           uint64
}

CPU metrics

type DeviceMapperStats added in v1.6.0

type DeviceMapperStats struct {
	DataAvailable        uint64
	DataUsed             uint64
	DataTotal            uint64
	DataUsagePercent     float64
	MetadataAvailable    uint64
	MetadataUsed         uint64
	MetadataTotal        uint64
	MetadataUsagePercent float64
}

DeviceMapperStats contains the stats of devicemapper storages driver type

func ParseDeviceMapperStats added in v1.6.0

func ParseDeviceMapperStats(info types.Info) (*DeviceMapperStats, error)

ParseDeviceMapperStats parses the output from the info DriverStatus info Array. This information is not consider stable by Docker and could change anytime according to API the docs.

type Memory

type Memory struct {
	UsageBytes            uint64
	CacheUsageBytes       uint64
	RSSUsageBytes         uint64
	MemLimitBytes         uint64
	UsagePercent          float64 // Usage percent from the limit, if any
	KernelUsageBytes      uint64
	SwapUsageBytes        uint64
	SwapOnlyUsageBytes    uint64
	SwapLimitBytes        uint64
	SwapLimitUsagePercent float64
	SoftLimitBytes        uint64
}

Memory metrics

type MetricsFetcher

type MetricsFetcher struct {
	// contains filtered or unexported fields
}

MetricsFetcher fetches the container system-level metrics from different sources and processes it to export metrics with business-value

func NewProcessor

func NewProcessor(store persist.Storer, fetcher raw.Fetcher, inspector raw.DockerInspector, exitedContainerTTL time.Duration) *MetricsFetcher

NewProcessor creates a MetricsFetcher from implementations of its required components

func (*MetricsFetcher) Process

func (mc *MetricsFetcher) Process(containerID string) (Sample, error)

Process returns a metrics Sample of the container with the given ID

func (*MetricsFetcher) WithRuntimeNumCPUfunc added in v1.9.0

func (mc *MetricsFetcher) WithRuntimeNumCPUfunc(rcFunc func() int)

WithRuntimeNumCPUfunc changes the NumCPU counting func so MetricsFetcher is mockable

type Network

type Network raw.Network

Network section of a container sample

type Pids

type Pids raw.Pids

Pids section of a container sample

type Processer

type Processer interface {
	Process(containerID string) (Sample, error)
}

Processer defines the most essential interface of an exportable container Processer

type Sample

type Sample struct {
	Pids         Pids
	Network      Network
	BlkIO        BlkIO
	CPU          CPU
	Memory       Memory
	RestartCount int
}

Sample exports the valuable metrics from a container

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL