docker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContainerName    = "docker_container_name"
	ContainerCommand = "docker_container_command"
	ContainerPorts   = "docker_container_ports"
	ContainerCreated = "docker_container_created"

	NetworkRxDropped = "network_rx_dropped"
	NetworkRxBytes   = "network_rx_bytes"
	NetworkRxErrors  = "network_rx_errors"
	NetworkTxPackets = "network_tx_packets"
	NetworkTxDropped = "network_tx_dropped"
	NetworkRxPackets = "network_rx_packets"
	NetworkTxErrors  = "network_tx_errors"
	NetworkTxBytes   = "network_tx_bytes"

	MemoryMaxUsage = "memory_max_usage"
	MemoryUsage    = "memory_usage"
	MemoryFailcnt  = "memory_failcnt"
	MemoryLimit    = "memory_limit"

	CPUPercpuUsage       = "cpu_per_cpu_usage"
	CPUUsageInUsermode   = "cpu_usage_in_usermode"
	CPUTotalUsage        = "cpu_total_usage"
	CPUUsageInKernelmode = "cpu_usage_in_kernelmode"
	CPUSystemCPUUsage    = "cpu_system_cpu_usage"
)

These constants are keys used in node metadata

View Source
const (
	StartEvent = "start"
	DieEvent   = "die"
)

Consts exported for testing.

View Source
const (
	ImageID   = "docker_image_id"
	ImageName = "docker_image_name"
)

Keys for use in NodeMetadata

View Source
const (
	Addr        = "addr"
	ContainerID = "docker_container_id"
	Domain      = "domain"
	Name        = "name"
	PID         = "pid"
	Port        = "port"
)

These constants are keys used in node metadata TODO: use these constants in report/{mapping.go, detailed_node.go} - pending some circular references

Variables

View Source
var (
	DialStub          = net.Dial
	NewClientConnStub = newClientConn
)

Exported for testing

View Source
var (
	NewDockerClientStub = newDockerClient
	NewContainerStub    = NewContainer
)

Vars exported for testing.

View Source
var (
	NewProcessTreeStub = process.NewTree
)

These vars are exported for testing.

Functions

This section is empty.

Types

type Client

type Client interface {
	ListContainers(docker_client.ListContainersOptions) ([]docker_client.APIContainers, error)
	InspectContainer(string) (*docker_client.Container, error)
	ListImages(docker_client.ListImagesOptions) ([]docker_client.APIImages, error)
	AddEventListener(chan<- *docker_client.APIEvents) error
	RemoveEventListener(chan *docker_client.APIEvents) error
}

Client interface for mocking.

type ClientConn

type ClientConn interface {
	Do(req *http.Request) (resp *http.Response, err error)
	Close() error
}

ClientConn is exported for testing

type Container

type Container interface {
	ID() string
	Image() string
	PID() int
	GetNodeMetadata() report.NodeMetadata

	StartGatheringStats() error
	StopGatheringStats()
}

Container represents a Docker container

func NewContainer

func NewContainer(c *docker.Container) Container

NewContainer creates a new Container

type Registry

type Registry interface {
	Stop()
	LockedPIDLookup(f func(func(int) Container))
	WalkContainers(f func(Container))
	WalkImages(f func(*docker_client.APIImages))
}

Registry keeps track of running docker containers and their images

func NewRegistry

func NewRegistry(interval time.Duration) (Registry, error)

NewRegistry returns a usable Registry. Don't forget to Stop it.

type Reporter

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

Reporter generate Reports containing Container and ContainerImage topologies

func NewReporter

func NewReporter(registry Registry, scope string) *Reporter

NewReporter makes a new Reporter

func (*Reporter) Report

func (r *Reporter) Report() (report.Report, error)

Report generates a Report containing Container and ContainerImage topologies

type Tagger

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

Tagger is a tagger that tags Docker container information to process nodes that have a PID.

func NewTagger

func NewTagger(registry Registry, procWalker process.Walker) *Tagger

NewTagger returns a usable Tagger.

func (*Tagger) Tag

func (t *Tagger) Tag(r report.Report) (report.Report, error)

Tag implements Tagger.

Jump to

Keyboard shortcuts

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