v2

package
v0.0.0-...-a768f24 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUStats

type CPUStats struct {
	Usage  CPUUsage `json:"cpu_usage"`
	System uint64   `json:"system_cpu_usage"`
}

CPUStats represents an ECS container CPU usage

type CPUUsage

type CPUUsage struct {
	Total      uint64 `json:"total_usage"`
	Usermode   uint64 `json:"usage_in_usermode"`
	Kernelmode uint64 `json:"usage_in_kernelmode"`
}

CPUUsage represents the details of ECS container CPU usage

type Client

type Client struct{}

Client represents a client for a metadata v2 API endpoint.

func NewDefaultClient

func NewDefaultClient() *Client

NewDefaultClient creates a new client for the default metadata v2 API endpoint.

func (*Client) GetTask

func (c *Client) GetTask(context.Context) (*Task, error)

GetTask returns the current task.

func (*Client) GetTaskWithTags

func (c *Client) GetTaskWithTags(context.Context) (*Task, error)

GetTaskWithTags returns the current task, including propagated resource tags.

type Container

type Container struct {
	Name          string            `json:"Name"`
	Limits        map[string]uint64 `json:"Limits"`
	ImageID       string            `json:"ImageID,omitempty"`
	StartedAt     string            `json:"StartedAt"` // 2017-11-17T17:14:07.781711848Z
	DockerName    string            `json:"DockerName"`
	Type          string            `json:"Type"`
	Image         string            `json:"Image"`
	Labels        map[string]string `json:"Labels"`
	KnownStatus   string            `json:"KnownStatus"` // See https://github.com/aws/amazon-ecs-agent/blob/master/agent/api/container/status/containerstatus.go
	DesiredStatus string            `json:"DesiredStatus"`
	DockerID      string            `json:"DockerID"`
	CreatedAt     string            `json:"CreatedAt"`
	Networks      []Network         `json:"Networks"`
	Ports         []Port            `json:"Ports"`
}

Container represents a container within a task.

type ContainerStats

type ContainerStats struct {
	Timestamp string      `json:"read"`
	CPU       CPUStats    `json:"cpu_stats"`
	Memory    MemStats    `json:"memory_stats"`
	IO        IOStats     `json:"blkio_stats"`
	Networks  NetStatsMap `json:"networks"`
}

ContainerStats represents the statistics of a container as returned by the ECS metadata API v2.

type DetailedMem

type DetailedMem struct {
	RSS     uint64 `json:"rss"`
	Cache   uint64 `json:"cache"`
	PgFault uint64 `json:"pgfault"`
}

DetailedMem stores detailed stats about memory usage

type IOStats

type IOStats struct {
	BytesPerDeviceAndKind []OPStat `json:"io_service_bytes_recursive"`
	OPPerDeviceAndKind    []OPStat `json:"io_serviced_recursive"`
	ReadBytes             uint64   // calculated by aggregating OPStats
	WriteBytes            uint64   // calculated by aggregating OPStats
}

IOStats represents an ECS container IO throughput

type MemStats

type MemStats struct {
	Details  DetailedMem `json:"stats"`
	Limit    uint64      `json:"limit"`
	MaxUsage uint64      `json:"max_usage"`
	Usage    uint64      `json:"usage"`
}

MemStats represents an ECS container memory usage

type NetStats

type NetStats struct {
	RxBytes   uint64 `json:"rx_bytes"`
	RxPackets uint64 `json:"rx_packets"`
	TxBytes   uint64 `json:"tx_bytes"`
	TxPackets uint64 `json:"tx_packets"`
}

NetStats represents an ECS container network usage

type NetStatsMap added in v0.9.0

type NetStatsMap map[string]NetStats

NetStatsMap represents a map of networks stats

type Network

type Network struct {
	NetworkMode   string   `json:"NetworkMode"`   // as of today the only supported mode is awsvpc
	IPv4Addresses []string `json:"IPv4Addresses"` // one-element list
}

Network represents the network of a container

type OPStat

type OPStat struct {
	Major int64  `json:"major"`
	Minor int64  `json:"minor"`
	Kind  string `json:"op"`
	Value uint64 `json:"value"`
}

OPStat stores a value (amount of op or bytes) for a kind of operation and a specific block device.

type Port

type Port struct {
	ContainerPort uint16 `json:"ContainerPort,omitempty"`
	Protocol      string `json:"Protocol,omitempty"`
	HostPort      uint16 `json:"HostPort,omitempty"`
}

Port represents the ports of a container

type Task

type Task struct {
	ClusterName           string             `json:"Cluster"`
	Containers            []Container        `json:"Containers"`
	KnownStatus           string             `json:"KnownStatus"`
	TaskARN               string             `json:"TaskARN"`
	Family                string             `json:"Family"`
	Version               string             `json:"Revision"`
	Limits                map[string]float64 `json:"Limits"`
	DesiredStatus         string             `json:"DesiredStatus"`
	AvailabilityZone      string             `json:"AvailabilityZone"`
	ContainerInstanceTags map[string]string  `json:"ContainerInstanceTags,omitempty"` // undocumented
	TaskTags              map[string]string  `json:"TaskTags,omitempty"`              // undocumented
}

Task represents a task as returned by the ECS metadata API v2.

Jump to

Keyboard shortcuts

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