Documentation ¶
Index ¶
- Constants
- Variables
- type ContainerMetadata
- type ContainerStats
- type DockerContainerMetadataResolver
- type DockerStatsEngine
- func (engine *DockerStatsEngine) ContainerDockerStats(taskARN string, containerID string) (*docker.Stats, error)
- func (engine *DockerStatsEngine) Disable()
- func (engine *DockerStatsEngine) GetInstanceMetrics() (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error)
- func (engine *DockerStatsEngine) GetTaskHealthMetrics() (*ecstcs.HealthMetadata, []*ecstcs.TaskHealth, error)
- func (engine *DockerStatsEngine) MustInit(ctx context.Context, taskEngine ecsengine.TaskEngine, cluster string, ...) error
- func (engine *DockerStatsEngine) Shutdown()
- type Engine
- type Queue
- func (queue *Queue) Add(dockerStat *docker.Stats) error
- func (queue *Queue) GetCPUStatsSet() (*ecstcs.CWStatsSet, error)
- func (queue *Queue) GetLastStat() *docker.Stats
- func (queue *Queue) GetMemoryStatsSet() (*ecstcs.CWStatsSet, error)
- func (queue *Queue) GetRawUsageStats(numStats int) ([]UsageStats, error)
- func (queue *Queue) Reset()
- type StatsContainer
- type UsageStats
Constants ¶
const ( // SleepBetweenUsageDataCollection is the sleep duration between collecting usage data for a container. SleepBetweenUsageDataCollection = 1 * time.Second // 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 (1) * 60 * Time duration in minutes to store the data for (2) ContainerStatsBufferLength = 120 )
const (
// BytesInMiB is the number of bytes in a MebiByte.
BytesInMiB = 1024 * 1024
)
Variables ¶
var ( // EmptyMetricsError indicates an error for a task when there are no container // metrics to report EmptyMetricsError = errors.New("stats engine: no task metrics to report") // EmptyHealthMetricsError indicates an error for a task when there are no container // health metrics to report EmptyHealthMetricsError = errors.New("stats engine: no task health metrics to report") )
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 DockerContainerMetadataResolver ¶
type DockerContainerMetadataResolver struct {
// contains filtered or unexported fields
}
DockerContainerMetadataResolver implements ContainerMetadataResolver for DockerTaskEngine.
func (*DockerContainerMetadataResolver) ResolveContainer ¶ added in v1.12.2
func (resolver *DockerContainerMetadataResolver) ResolveContainer(dockerID string) (*api.DockerContainer, error)
ResolveContainer resolves the api container object, given container id.
func (*DockerContainerMetadataResolver) ResolveTask ¶
func (resolver *DockerContainerMetadataResolver) ResolveTask(dockerID string) (*api.Task, error)
ResolveTask resolves the api task object, 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, client dockerapi.DockerClient, containerChangeEventStream *eventstream.EventStream) *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) ContainerDockerStats ¶
func (engine *DockerStatsEngine) ContainerDockerStats(taskARN string, containerID string) (*docker.Stats, error)
ContainerDockerStats returns the last stored raw docker stats object for a container
func (*DockerStatsEngine) Disable ¶
func (engine *DockerStatsEngine) Disable()
Disable prevents this engine from managing any additional tasks.
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) GetTaskHealthMetrics ¶
func (engine *DockerStatsEngine) GetTaskHealthMetrics() (*ecstcs.HealthMetadata, []*ecstcs.TaskHealth, error)
GetTaskHealthMetrics returns the container health metrics
func (*DockerStatsEngine) MustInit ¶
func (engine *DockerStatsEngine) MustInit(ctx context.Context, taskEngine ecsengine.TaskEngine, cluster string, containerInstanceArn string) error
MustInit initializes fields of the DockerStatsEngine object.
func (*DockerStatsEngine) Shutdown ¶
func (engine *DockerStatsEngine) Shutdown()
Shutdown cleans up the resources after the statas engine.
type Engine ¶
type Engine interface { GetInstanceMetrics() (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error) ContainerDockerStats(taskARN string, containerID string) (*docker.Stats, error) GetTaskHealthMetrics() (*ecstcs.HealthMetadata, []*ecstcs.TaskHealth, error) }
Engine defines methods to be implemented by the engine struct. It is defined to make testing easier.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue abstracts a queue using UsageStats slice.
func (*Queue) GetCPUStatsSet ¶
func (queue *Queue) GetCPUStatsSet() (*ecstcs.CWStatsSet, error)
GetCPUStatsSet gets the stats set for CPU utilization.
func (*Queue) GetLastStat ¶
GetLastStat returns the last recorded raw statistics object from docker
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.
type StatsContainer ¶ added in v1.10.0
type StatsContainer struct {
// contains filtered or unexported fields
}
StatsContainer abstracts methods to gather and aggregate utilization data for a container.
func (*StatsContainer) StartStatsCollection ¶ added in v1.10.0
func (container *StatsContainer) StartStatsCollection()
func (*StatsContainer) StopStatsCollection ¶ added in v1.10.0
func (container *StatsContainer) StopStatsCollection()