collector

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainersOf

func ContainersOf(sig RawSignal) ([]docker.ContainerInfo, bool)

ContainersOf extracts a container list from a poll signal.

Types

type Collector

type Collector interface {
	Name() string
	Start(ctx context.Context, out chan<- RawSignal) error
}

Collector produces raw signals from one observation source.

type ContainerListPayload

type ContainerListPayload struct {
	Containers []docker.ContainerInfo
}

ContainerListPayload is the poll collector's raw payload.

type DockerEventPayload

type DockerEventPayload struct {
	Event docker.ContainerEvent
}

DockerEventPayload wraps a distilled container event.

type Events

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

Events streams docker events as raw signals (primary lifecycle source).

func NewEvents

func NewEvents(dc *docker.Client) *Events

NewEvents returns a docker-events collector.

func (*Events) Name

func (e *Events) Name() string

Name returns the collector name.

func (*Events) Start

func (e *Events) Start(ctx context.Context, out chan<- RawSignal) error

Start streams docker event signals until ctx is cancelled.

type Inspect

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

Inspect is a one-shot collector for a single container inspect.

func NewInspect

func NewInspect(dc *docker.Client, containerID string) *Inspect

NewInspect returns an inspect collector for containerID.

func (*Inspect) Name

func (i *Inspect) Name() string

Name returns the collector name.

func (*Inspect) Start

func (i *Inspect) Start(ctx context.Context, out chan<- RawSignal) error

Start emits one inspect signal then returns.

type InspectPayload

type InspectPayload struct {
	ContainerID string
	Info        *docker.InspectInfo
	Err         error
}

InspectPayload is one on-demand inspect result.

type Kind

type Kind string

Kind identifies the source-specific shape of a RawSignal payload.

const (
	KindContainerList Kind = "container_list"
	KindInspect       Kind = "inspect"
	KindLogLine       Kind = "log_line"
	KindStats         Kind = "stats"
)

Collector signal kinds.

const KindDockerEvent Kind = "docker_event"

KindDockerEvent is emitted by the docker-events collector.

type LogLinePayload

type LogLinePayload struct {
	ContainerID string
	Line        string
	Err         error
}

LogLinePayload is one streamed log line (or stream error).

type Logs

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

Logs wraps docker log follow as a collector.

func NewLogs

func NewLogs(dc *docker.Client, containerID string, tail int) *Logs

NewLogs returns a log-follow collector.

func (*Logs) Name

func (l *Logs) Name() string

Name returns the collector name.

func (*Logs) Start

func (l *Logs) Start(ctx context.Context, out chan<- RawSignal) error

Start streams log-line signals until ctx is cancelled or the stream ends.

type Poll

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

Poll wraps the existing 500 ms Docker poller as a fallback collector. docker events (Phase 1.4) will become the primary lifecycle source.

func NewPoll

func NewPoll(dc *docker.Client) *Poll

NewPoll returns a poll collector bound to dc.

func (*Poll) Name

func (p *Poll) Name() string

Name returns the collector name.

func (*Poll) Start

func (p *Poll) Start(ctx context.Context, out chan<- RawSignal) error

Start streams container-list signals until ctx is cancelled.

type RawSignal

type RawSignal struct {
	Kind      Kind
	Timestamp int64 // unix nano
	Payload   any
}

RawSignal is a source-specific observation before normalization. Payload types are owned by the emitting collector (see poll.go, etc.).

type Stats

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

Stats collects one-shot stats for a set of containers.

func NewStats

func NewStats(dc *docker.Client, containerIDs []string) *Stats

NewStats returns a one-shot stats collector.

func (*Stats) Name

func (s *Stats) Name() string

Name returns the collector name.

func (*Stats) Start

func (s *Stats) Start(ctx context.Context, out chan<- RawSignal) error

Start emits one stats batch signal then returns.

type StatsPayload

type StatsPayload struct {
	Samples map[string]*docker.StatsInfo
}

StatsPayload is one batch of one-shot stats samples.

Jump to

Keyboard shortcuts

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