Documentation ¶
Index ¶
- Constants
- Variables
- type BlockStatKey
- type BlockStatValue
- type ContainerMetadata
- type ContainerStats
- type DockerContainerMetadataResolver
- func (resolver *DockerContainerMetadataResolver) ResolveContainer(dockerID string) (*apicontainer.DockerContainer, error)
- func (resolver *DockerContainerMetadataResolver) ResolveTask(dockerID string) (*apitask.Task, error)
- func (resolver *DockerContainerMetadataResolver) ResolveTaskByARN(taskArn string) (*apitask.Task, error)
- type DockerStatsEngine
- func (engine *DockerStatsEngine) ContainerDockerStats(taskARN string, containerID string) (*types.StatsJSON, *stats.NetworkStatsPerSec, error)
- func (engine *DockerStatsEngine) Disable()
- func (engine *DockerStatsEngine) GetInstanceMetrics(includeServiceConnectStats bool) (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error)
- func (engine *DockerStatsEngine) GetPublishMetricsTicker() *time.Ticker
- func (engine *DockerStatsEngine) GetPublishServiceConnectTickerInterval() int32
- 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) SetPublishServiceConnectTickerInterval(publishServiceConnectTickerInterval int32)
- func (engine *DockerStatsEngine) Shutdown()
- func (engine *DockerStatsEngine) StartMetricsPublish()
- type Engine
- type NetworkStats
- type NonDockerContainerStats
- type Queue
- func (queue *Queue) Add(dockerStat *types.StatsJSON, nonDockerStats NonDockerContainerStats) error
- func (queue *Queue) AddContainerStat(dockerStat *types.StatsJSON, nonDockerStats NonDockerContainerStats, ...) error
- func (queue *Queue) GetCPUStatsSet() (*ecstcs.CWStatsSet, error)
- func (queue *Queue) GetLastNetworkStatPerSec() *stats.NetworkStatsPerSec
- func (queue *Queue) GetLastStat() *types.StatsJSON
- func (queue *Queue) GetMemoryStatsSet() (*ecstcs.CWStatsSet, error)
- func (queue *Queue) GetNetworkStatsSet() (*ecstcs.NetworkStatsSet, error)
- func (queue *Queue) GetRestartStatsSet() (*ecstcs.RestartStatsSet, error)
- func (queue *Queue) GetStorageStatsSet() (*ecstcs.StorageStatsSet, error)
- func (queue *Queue) Reset()
- type ServiceConnectStats
- type StatsContainer
- type StatsTask
- type TaskMetadata
- type UsageStats
Constants ¶
const ( // BytesInMiB is the number of bytes in a MebiByte. BytesInMiB = 1024 * 1024 MaxCPUUsagePerc float32 = 1024 * 1024 NanoSecToSec float32 = 1000000000 )
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 BlockStatKey ¶
type BlockStatValue ¶
type ContainerMetadata ¶
type ContainerMetadata struct { DockerID string `json:"-"` Name string `json:"-"` NetworkMode string `json:"-"` StartedAt time.Time `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 ¶
func (resolver *DockerContainerMetadataResolver) ResolveContainer(dockerID string) (*apicontainer.DockerContainer, error)
ResolveContainer resolves the api container object, given container id.
func (*DockerContainerMetadataResolver) ResolveTask ¶
func (resolver *DockerContainerMetadataResolver) ResolveTask(dockerID string) (*apitask.Task, error)
ResolveTask resolves the api task object, given container id.
func (*DockerContainerMetadataResolver) ResolveTaskByARN ¶
func (resolver *DockerContainerMetadataResolver) ResolveTaskByARN(taskArn string) (*apitask.Task, error)
type DockerStatsEngine ¶
type DockerStatsEngine struct {
// contains filtered or unexported fields
}
func NewDockerStatsEngine ¶
func NewDockerStatsEngine(cfg *config.Config, client dockerapi.DockerClient, containerChangeEventStream *eventstream.EventStream, metricsChannel chan<- ecstcs.TelemetryMessage, healthChannel chan<- ecstcs.HealthMessage, dataClient data.Client) *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) (*types.StatsJSON, *stats.NetworkStatsPerSec, 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(includeServiceConnectStats bool) (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error)
GetInstanceMetrics gets all task metrics and instance metadata from stats engine.
func (*DockerStatsEngine) GetPublishMetricsTicker ¶
func (engine *DockerStatsEngine) GetPublishMetricsTicker() *time.Ticker
func (*DockerStatsEngine) GetPublishServiceConnectTickerInterval ¶
func (engine *DockerStatsEngine) GetPublishServiceConnectTickerInterval() int32
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) SetPublishServiceConnectTickerInterval ¶
func (engine *DockerStatsEngine) SetPublishServiceConnectTickerInterval(publishServiceConnectTickerInterval int32)
func (*DockerStatsEngine) Shutdown ¶
func (engine *DockerStatsEngine) Shutdown()
Shutdown cleans up the resources after the stats engine.
func (*DockerStatsEngine) StartMetricsPublish ¶
func (engine *DockerStatsEngine) StartMetricsPublish()
StartMetricsPublish starts to collect and publish task and health metrics
type Engine ¶
type Engine interface { GetInstanceMetrics(includeServiceConnectStats bool) (*ecstcs.MetricsMetadata, []*ecstcs.TaskMetric, error) ContainerDockerStats(taskARN string, containerID string) (*types.StatsJSON, *stats.NetworkStatsPerSec, error) GetTaskHealthMetrics() (*ecstcs.HealthMetadata, []*ecstcs.TaskHealth, error) GetPublishServiceConnectTickerInterval() int32 SetPublishServiceConnectTickerInterval(int32) GetPublishMetricsTicker() *time.Ticker }
Engine defines methods to be implemented by the engine struct. It is defined to make testing easier.
type NetworkStats ¶
type NetworkStats struct { RxBytes uint64 `json:"rxBytes"` RxDropped uint64 `json:"rxDropped"` RxErrors uint64 `json:"rxErrors"` RxPackets uint64 `json:"rxPackets"` TxBytes uint64 `json:"txBytes"` TxDropped uint64 `json:"txDropped"` TxErrors uint64 `json:"txErrors"` TxPackets uint64 `json:"txPackets"` RxBytesPerSecond float32 `json:"rxBytesPerSecond"` TxBytesPerSecond float32 `json:"txBytesPerSecond"` }
NetworkStats contains the network stats information for a container
type NonDockerContainerStats ¶
type NonDockerContainerStats struct {
// contains filtered or unexported fields
}
NonDockerContainerStats contains stats for a container that are not gotten from docker. These are amended to the docker stats and added to the stats queue if they are available.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue abstracts a queue using UsageStats slice.
func (*Queue) Add ¶
func (queue *Queue) Add(dockerStat *types.StatsJSON, nonDockerStats NonDockerContainerStats) error
Add adds a new set of stats to the queue.
func (*Queue) AddContainerStat ¶
func (queue *Queue) AddContainerStat(dockerStat *types.StatsJSON, nonDockerStats NonDockerContainerStats, lastStatBeforeLastRestart *types.StatsJSON, containerHasRestartedBefore bool) error
AddContainerStat adds a new set of stats for a container to the queue. This method is only intended for use while processing docker stats for a stats container.
func (*Queue) GetCPUStatsSet ¶
func (queue *Queue) GetCPUStatsSet() (*ecstcs.CWStatsSet, error)
GetCPUStatsSet gets the stats set for CPU utilization.
func (*Queue) GetLastNetworkStatPerSec ¶
func (queue *Queue) GetLastNetworkStatPerSec() *stats.NetworkStatsPerSec
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) GetNetworkStatsSet ¶
func (queue *Queue) GetNetworkStatsSet() (*ecstcs.NetworkStatsSet, error)
GetNetworkStatsSet gets the stats set for network metrics.
func (*Queue) GetRestartStatsSet ¶
func (queue *Queue) GetRestartStatsSet() (*ecstcs.RestartStatsSet, error)
GetRestartStatsSet gets the stats set for container restarts
func (*Queue) GetStorageStatsSet ¶
func (queue *Queue) GetStorageStatsSet() (*ecstcs.StorageStatsSet, error)
GetStorageStatsSet gets the stats set for aggregate storage
type ServiceConnectStats ¶
type ServiceConnectStats struct {
// contains filtered or unexported fields
}
func (*ServiceConnectStats) GetStats ¶
func (sc *ServiceConnectStats) GetStats() []*ecstcs.GeneralMetricsWrapper
func (*ServiceConnectStats) HasStatsBeenSent ¶
func (sc *ServiceConnectStats) HasStatsBeenSent() bool
func (*ServiceConnectStats) SetStatsSent ¶
func (sc *ServiceConnectStats) SetStatsSent(sent bool)
type StatsContainer ¶
type StatsContainer struct {
// contains filtered or unexported fields
}
StatsContainer abstracts methods to gather and aggregate utilization data for a container.
func (*StatsContainer) StartStatsCollection ¶
func (container *StatsContainer) StartStatsCollection()
func (*StatsContainer) StopStatsCollection ¶
func (container *StatsContainer) StopStatsCollection()
type StatsTask ¶
type StatsTask struct {
// contains filtered or unexported fields
}
func (*StatsTask) StartStatsCollection ¶
func (taskStat *StatsTask) StartStatsCollection()
func (*StatsTask) StopStatsCollection ¶
func (taskStat *StatsTask) StopStatsCollection()
type TaskMetadata ¶
type TaskMetadata struct { TaskArn string `json:"-"` TaskId string `json:"-"` // ContainerPID is the PID of the pause container in the awsvpc task. ContainerPID string `json:"-"` DeviceName []string `json:"-"` NumberContainers int `json:"-"` }
TaskMetadata contains meta-data information for a task.
type UsageStats ¶
type UsageStats struct { CPUUsagePerc float32 `json:"cpuUsagePerc"` MemoryUsageInMegs uint32 `json:"memoryUsageInMegs"` StorageReadBytes uint64 `json:"storageReadBytes"` StorageWriteBytes uint64 `json:"storageWriteBytes"` NetworkStats *NetworkStats `json:"networkStats"` RestartCount *int64 `json:"restartCount"` Timestamp time.Time `json:"timestamp"` // contains filtered or unexported fields }
UsageStats abstracts the format in which the queue stores data.