containers

package
v1.23.11 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinTrafficStatsUpdateInterval = 5 * time.Second
	IgnoredContainersCacheTTL     = 15 * time.Second
)

Variables

View Source
var (
	L7Requests = map[l7.Protocol]prometheus.CounterOpts{
		l7.ProtocolHTTP:       {Name: "container_http_requests_total", Help: "Total number of outbound HTTP requests"},
		l7.ProtocolPostgres:   {Name: "container_postgres_queries_total", Help: "Total number of outbound Postgres queries"},
		l7.ProtocolRedis:      {Name: "container_redis_queries_total", Help: "Total number of outbound Redis queries"},
		l7.ProtocolMemcached:  {Name: "container_memcached_queries_total", Help: "Total number of outbound Memcached queries"},
		l7.ProtocolMysql:      {Name: "container_mysql_queries_total", Help: "Total number of outbound Mysql queries"},
		l7.ProtocolMongo:      {Name: "container_mongo_queries_total", Help: "Total number of outbound Mongo queries"},
		l7.ProtocolKafka:      {Name: "container_kafka_requests_total", Help: "Total number of outbound Kafka requests"},
		l7.ProtocolCassandra:  {Name: "container_cassandra_queries_total", Help: "Total number of outbound Cassandra requests"},
		l7.ProtocolRabbitmq:   {Name: "container_rabbitmq_messages_total", Help: "Total number of Rabbitmq messages produced or consumed by the container"},
		l7.ProtocolNats:       {Name: "container_nats_messages_total", Help: "Total number of NATS messages produced or consumed by the container"},
		l7.ProtocolDubbo2:     {Name: "container_dubbo_requests_total", Help: "Total number of outbound DUBBO requests"},
		l7.ProtocolDNS:        {Name: "container_dns_requests_total", Help: "Total number of outbound DNS requests"},
		l7.ProtocolClickhouse: {Name: "container_clickhouse_queries_total", Help: "Total number of outbound ClickHouse queries"},
		l7.ProtocolZookeeper:  {Name: "container_zookeeper_requests_total", Help: "Total number of outbound Zookeeper requests"},
	}
	L7Latency = map[l7.Protocol]prometheus.HistogramOpts{
		l7.ProtocolHTTP:       {Name: "container_http_requests_duration_seconds_total", Help: "Histogram of the response time for each outbound HTTP request"},
		l7.ProtocolPostgres:   {Name: "container_postgres_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound Postgres query"},
		l7.ProtocolRedis:      {Name: "container_redis_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound Redis query"},
		l7.ProtocolMemcached:  {Name: "container_memcached_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound Memcached query"},
		l7.ProtocolMysql:      {Name: "container_mysql_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound Mysql query"},
		l7.ProtocolMongo:      {Name: "container_mongo_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound Mongo query"},
		l7.ProtocolKafka:      {Name: "container_kafka_requests_duration_seconds_total", Help: "Histogram of the execution time for each outbound Kafka request"},
		l7.ProtocolCassandra:  {Name: "container_cassandra_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound Cassandra request"},
		l7.ProtocolDubbo2:     {Name: "container_dubbo_requests_duration_seconds_total", Help: "Histogram of the response time for each outbound DUBBO request"},
		l7.ProtocolDNS:        {Name: "container_dns_requests_duration_seconds_total", Help: "Histogram of the response time for each outbound DNS request"},
		l7.ProtocolClickhouse: {Name: "container_clickhouse_queries_duration_seconds_total", Help: "Histogram of the execution time for each outbound ClickHouse query"},
		l7.ProtocolZookeeper:  {Name: "container_zookeeper_requests_duration_seconds_total", Help: "Histogram of the execution time for each outbound Zookeeper request"},
	}
)

Functions

func ContainerdInit

func ContainerdInit() error

func CrioInit added in v1.8.8

func CrioInit() error

func DockerdInit

func DockerdInit() error

func JournaldInit

func JournaldInit() error

func JournaldSubscribe

func JournaldSubscribe(cg *cgroup.Cgroup, ch chan<- logparser.LogEntry) error

func JournaldUnsubscribe

func JournaldUnsubscribe(cg *cgroup.Cgroup)

func SystemdTriggeredBy added in v1.20.2

func SystemdTriggeredBy(id string) string

func TaskstatsInit

func TaskstatsInit() error

func TaskstatsPID

func TaskstatsPID(pid uint32) (*taskstats.Stats, error)

func TaskstatsTGID

func TaskstatsTGID(pid uint32) (*taskstats.Stats, error)

Types

type ActiveConnection added in v1.2.0

type ActiveConnection struct {
	DestinationKey common.DestinationKey
	Pid            uint32
	Fd             uint64
	Timestamp      uint64
	Closed         time.Time

	BytesSent     uint64
	BytesReceived uint64
	// contains filtered or unexported fields
}

type ConnectionKey added in v1.21.10

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

type ConnectionStats added in v1.20.4

type ConnectionStats struct {
	Count           uint64
	TotalTime       time.Duration
	Retransmissions uint64
	BytesSent       uint64
	BytesReceived   uint64
}

type Container

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

func NewContainer

func NewContainer(id ContainerID, cg *cgroup.Cgroup, md *ContainerMetadata, pid uint32, registry *Registry) (*Container, error)

func (*Container) Close

func (c *Container) Close()

func (*Container) Collect

func (c *Container) Collect(ch chan<- prometheus.Metric)

func (*Container) Dead

func (c *Container) Dead(now time.Time) bool

func (*Container) Describe

func (c *Container) Describe(ch chan<- *prometheus.Desc)

type ContainerID

type ContainerID string

type ContainerMetadata

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

func ContainerdInspect

func ContainerdInspect(containerID string) (*ContainerMetadata, error)

func CrioInspect added in v1.8.8

func CrioInspect(containerID string) (*ContainerMetadata, error)

func DockerdInspect

func DockerdInspect(containerID string) (*ContainerMetadata, error)

type ContainerNetwork added in v1.8.4

type ContainerNetwork struct {
	NetworkID string
}

type CrioContainerInfo added in v1.8.8

type CrioContainerInfo struct {
	Name            string            `json:"name"`
	Image           string            `json:"image"`
	Labels          map[string]string `json:"labels"`
	LogPath         string            `json:"log_path"`
	CrioAnnotations map[string]string `json:"crio_annotations"`
}

type CrioVolume added in v1.8.8

type CrioVolume struct {
	ContainerPath string `json:"container_path"`
	HostPath      string `json:"host_path"`
}

type Delays

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

type DotNetMonitor added in v1.16.0

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

func NewDotNetMonitor added in v1.16.0

func NewDotNetMonitor(ctx context.Context, pid uint32, appName string) *DotNetMonitor

func (*DotNetMonitor) AppName added in v1.21.8

func (m *DotNetMonitor) AppName() string

func (*DotNetMonitor) Collect added in v1.16.0

func (m *DotNetMonitor) Collect(ch chan<- prometheus.Metric)

type L7Metrics added in v1.12.0

type L7Metrics struct {
	Requests *prometheus.CounterVec
	Latency  prometheus.Histogram
}

type L7Stats added in v1.2.0

type L7Stats map[l7.Protocol]map[common.DestinationKey]*L7Metrics // protocol -> dst:actual_dst -> metrics

type ListenDetails added in v1.8.6

type ListenDetails struct {
	ClosedAt time.Time
	NsIPs    []netaddr.IP
}

type LogParser

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

func (*LogParser) Stop

func (p *LogParser) Stop()

type PidFd added in v1.14.0

type PidFd struct {
	Pid uint32
	Fd  uint64
}

type Process added in v1.8.6

type Process struct {
	Pid       uint32
	StartedAt time.Time
	// contains filtered or unexported fields
}

func NewProcess added in v1.16.0

func NewProcess(pid uint32, stats *taskstats.Stats, tracer *ebpftracer.Tracer) *Process

func (*Process) Close added in v1.16.0

func (p *Process) Close()

func (*Process) NetNsId added in v1.8.6

func (p *Process) NetNsId() string

type ProcessInfo added in v1.15.0

type ProcessInfo struct {
	Pid         uint32
	ContainerId ContainerID
	StartedAt   time.Time
}

type Registry

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

func NewRegistry

func NewRegistry(reg prometheus.Registerer, processInfoCh chan<- ProcessInfo) (*Registry, error)

func (*Registry) Close

func (r *Registry) Close()

func (*Registry) Collect added in v1.19.0

func (r *Registry) Collect(ch chan<- prometheus.Metric)

func (*Registry) Describe added in v1.19.0

func (r *Registry) Describe(ch chan<- *prometheus.Desc)

type TrafficStatsUpdate added in v1.21.0

type TrafficStatsUpdate struct {
	Pid           uint32
	FD            uint64
	BytesSent     uint64
	BytesReceived uint64
}

Jump to

Keyboard shortcuts

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