stats

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DockerExecDriverPath points to the docker exec driver path.
	DockerExecDriverPath = "execdriver/native"

	// SleepBetweenUsageDataCollection is the sleep duration between collecting usage data for a container.
	SleepBetweenUsageDataCollection = 500 * time.Millisecond

	// ContainerStatsBufferLength is the number of usage metrics stored in memory for a container. It is calculated as
	// Number of usage metrics gathered in a second (2) * 60 * Time duration in minutes to store the data for (2)
	ContainerStatsBufferLength = 240
)
View Source
const (
	// BytesInMiB is the number of bytes in a MebiByte.
	BytesInMiB = 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerMetadata

type ContainerMetadata struct {
	DockerID string `json:"-"`
}

ContainerMetadata contains meta-data information for a container.

type ContainerStats

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

ContainerStats encapsulates the raw CPU and memory utilization from cgroup fs.

type ContainerStatsCollector

type ContainerStatsCollector interface {
	// contains filtered or unexported methods
}

ContainerStatsCollector defines methods to get container stats. This interface is defined to make testing easier.

type CronContainer

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

CronContainer abstracts methods to gather and aggregate utilization data for a container.

func (*CronContainer) StartStatsCron

func (container *CronContainer) StartStatsCron()

StartStatsCron starts a go routine to periodically pull usage data for the container.

func (*CronContainer) StopStatsCron

func (container *CronContainer) StopStatsCron()

StopStatsCron stops the periodic collection of usage data for the container..

type DockerContainerMetadataResolver

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

DockerContainerMetadataResolver implements ContainerMetadataResolver for DockerTaskEngine.

func (*DockerContainerMetadataResolver) ResolveTask

func (resolver *DockerContainerMetadataResolver) ResolveTask(dockerID string) (*api.Task, error)

ResolveTask resolves the task arn, given container id.

type DockerStatsEngine

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

DockerStatsEngine is used to monitor docker container events and to report utlization metrics of the same.

func NewDockerStatsEngine

func NewDockerStatsEngine(cfg *config.Config) *DockerStatsEngine

NewDockerStatsEngine creates a new instance of the DockerStatsEngine object. MustInit() must be called to initialize the fields of the new event listener.

func (*DockerStatsEngine) GetInstanceMetrics

func (engine *DockerStatsEngine) GetInstanceMetrics() (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error)

GetInstanceMetrics gets all task metrics and instance metadata from stats engine.

func (*DockerStatsEngine) Init

func (engine *DockerStatsEngine) Init() error

Init initializes the docker client's event engine. This must be called to subscribe to the docker's event stream.

func (*DockerStatsEngine) MustInit

func (engine *DockerStatsEngine) MustInit(taskEngine ecsengine.TaskEngine, cluster string, containerInstanceArn string) error

MustInit initializes fields of the DockerStatsEngine object.

type Engine

type Engine interface {
	GetInstanceMetrics() (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error)
}

Engine defines methods to be implemented by the engine struct. It is defined to make testing easier.

type LibcontainerStatsCollector

type LibcontainerStatsCollector struct{}

LibcontainerStatsCollector implements ContainerStatsCollector.

type Queue

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

Queue abstracts a queue using UsageStats slice.

func NewQueue

func NewQueue(maxSize int) *Queue

NewQueue creates a queue.

func (*Queue) Add

func (queue *Queue) Add(rawStat *ContainerStats)

Add adds a new set of container stats to the queue.

func (*Queue) GetCPUStatsSet

func (queue *Queue) GetCPUStatsSet() (*ecstcs.CWStatsSet, error)

GetCPUStatsSet gets the stats set for CPU utilization.

func (*Queue) GetMemoryStatsSet

func (queue *Queue) GetMemoryStatsSet() (*ecstcs.CWStatsSet, error)

GetMemoryStatsSet gets the stats set for memory utilization.

func (*Queue) GetRawUsageStats

func (queue *Queue) GetRawUsageStats(numStats int) ([]UsageStats, error)

GetRawUsageStats gets the array of most recent raw UsageStats, in descending order of timestamps.

func (*Queue) Reset

func (queue *Queue) Reset()

Reset resets the stats queue.

type UsageStats

type UsageStats struct {
	CPUUsagePerc      float32   `json:"cpuUsagePerc"`
	MemoryUsageInMegs uint32    `json:"memoryUsageInMegs"`
	Timestamp         time.Time `json:"timestamp"`
	// contains filtered or unexported fields
}

UsageStats abstracts the format in which the queue stores data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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