task

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUStats

type CPUStats struct {
	Total uint64
	Limit float64
}

CPUStats represents cpu stats

type Container

type Container struct {
	DockerID   string
	DockerName string
	Name       string
}

Container represents container

type MemoryStats

type MemoryStats struct {
	Usage uint64
	Stats map[string]uint64
	Limit uint64
}

MemoryStats represents memory stats

type Metadata

type Metadata struct {
	Arn           string
	DesiredStatus string
	KnownStatus   string
	Family        string
	Version       string
	Containers    []Container `json:"Containers"`

	Instance *ecsTypes.MetadataResponse
	Limits   ResourceLimits
}

Metadata represents task metadata

type MockTask

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

MockTask is mock cgroup.

func NewMockTask

func NewMockTask(opts ...MockTaskOption) *MockTask

NewMockTask creates a new mock Task.

func (*MockTask) ApplyOption

func (p *MockTask) ApplyOption(opt MockTaskOption)

ApplyOption apply MockTaskOption.

func (*MockTask) IsPrivateNetworkMode

func (p *MockTask) IsPrivateNetworkMode() bool

IsPrivateNetworkMode returns true when task is private network mode.

func (*MockTask) Metadata

func (p *MockTask) Metadata(ctx context.Context) (*Metadata, error)

Metadata returns task metadata.

func (*MockTask) Stats

func (p *MockTask) Stats(ctx context.Context) (map[string]*Stats, error)

Stats returns task stats.

type MockTaskOption

type MockTaskOption func(*MockTask)

MockTaskOption is functional option.

func MockIsPrivateNetworkMode

func MockIsPrivateNetworkMode(callback func() bool) MockTaskOption

MockIsPrivateNetworkMode returns MockTaskOption to replace IsPrivateNetworkMode().

func MockMetadata

func MockMetadata(callback func(context.Context) (*Metadata, error)) MockTaskOption

MockMetadata returns MockTaskOption to replace Metadata().

func MockStats

func MockStats(callback func(context.Context) (map[string]*Stats, error)) MockTaskOption

MockStats returns MockTaskOption to replace Stats().

type NetworkStats

type NetworkStats struct {
	Name             string
	RxBytes, TxBytes uint64
}

NetworkStats represents network stats

type ResourceLimits

type ResourceLimits struct {
	CPU    float64
	Memory uint64
}

ResourceLimits represents task resouce limits

type Stats

type Stats struct {
	CPU     CPUStats
	Memory  MemoryStats
	Network map[string]NetworkStats
}

Stats represents resource stats

type Task

type Task interface {
	Metadata(context.Context) (*Metadata, error)
	Stats(context.Context) (map[string]*Stats, error)
	IsPrivateNetworkMode() bool
}

Task interface gets task metric values and metadata

func NewTaskWithProc

func NewTaskWithProc(ctx context.Context, proc procfs.Proc, dockerClient docker.Client, agentClient agent.Client, cgroup cgroupfs.Cgroup, ignoreContainer *regexp.Regexp) (Task, error)

NewTaskWithProc creates a new Task

Jump to

Keyboard shortcuts

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