observability

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLogReadLimit = 1000

Variables

This section is empty.

Functions

func CGroupPathForPid

func CGroupPathForPid(pid uint32) (string, error)

func TestInject

func TestInject(reg *asm.Registry)

Types

type BoundPort

type BoundPort struct {
	Addr netip.Addr
	Port int
}

type DebugLogWriter

type DebugLogWriter struct {
	Log *slog.Logger
}

func (*DebugLogWriter) WriteEntry

func (d *DebugLogWriter) WriteEntry(entity string, le LogEntry) error

type EntityStatus

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

func (*EntityStatus) Id

func (e *EntityStatus) Id() string

type LogEntry

type LogEntry struct {
	Timestamp  time.Time
	Stream     LogStream
	TraceID    string
	Attributes map[string]string
	Body       string
}

type LogReader

type LogReader struct {
	Address string        `asm:"victorialogs-address"`
	Timeout time.Duration `asm:"victorialogs-timeout"`
	// contains filtered or unexported fields
}

func (*LogReader) Populated

func (l *LogReader) Populated() error

func (*LogReader) Read

func (l *LogReader) Read(ctx context.Context, id string, opts ...LogReaderOption) ([]LogEntry, error)

func (*LogReader) ReadBySandbox

func (l *LogReader) ReadBySandbox(ctx context.Context, sandboxID string, opts ...LogReaderOption) ([]LogEntry, error)

func (*LogReader) ReadStream

func (l *LogReader) ReadStream(ctx context.Context, target LogTarget, logCh chan<- LogEntry, opts ...LogReaderOption) error

ReadStream queries historical logs and sends them to a channel as they're parsed. Unlike Read(), this has no limit and streams results incrementally.

func (*LogReader) TailStream

func (l *LogReader) TailStream(ctx context.Context, target LogTarget, logCh chan<- LogEntry, opts ...LogReaderOption) error

TailStream connects to VictoriaLogs tail endpoint for live tailing. Blocks until context is cancelled.

type LogReaderOption

type LogReaderOption func(*logReadOpts)

func WithFromTime

func WithFromTime(t time.Time) LogReaderOption

func WithLimit

func WithLimit(l int) LogReaderOption

type LogStream

type LogStream string
const (
	Stdout  LogStream = "stdout"
	Stderr  LogStream = "stderr"
	Error   LogStream = "error"
	UserOOB LogStream = "user-oob"
)

type LogTarget

type LogTarget struct {
	EntityID  string
	SandboxID string
}

LogTarget specifies what logs to query - either by entity ID or sandbox ID.

type LogWriter

type LogWriter interface {
	WriteEntry(entity string, le LogEntry) error
}

type LogsMaintainer

type LogsMaintainer struct {
}

func (*LogsMaintainer) Setup

func (m *LogsMaintainer) Setup(ctx context.Context) error

type PersistentLogReader

type PersistentLogReader struct {
	Address string        `asm:"victorialogs-address"`
	Timeout time.Duration `asm:"victorialogs-timeout"`
	// contains filtered or unexported fields
}

func (*PersistentLogReader) Populated

func (l *PersistentLogReader) Populated() error

func (*PersistentLogReader) Read

func (l *PersistentLogReader) Read(ctx context.Context, id string) ([]LogEntry, error)

type PersistentLogWriter

type PersistentLogWriter struct {
	Address string        `asm:"victorialogs-address"`
	Timeout time.Duration `asm:"victorialogs-timeout"`
	// contains filtered or unexported fields
}

func (*PersistentLogWriter) Client

func (l *PersistentLogWriter) Client() *http.Client

func (*PersistentLogWriter) Populated

func (l *PersistentLogWriter) Populated() error

func (*PersistentLogWriter) WriteEntry

func (l *PersistentLogWriter) WriteEntry(entity string, le LogEntry) error

type PortStatus

type PortStatus string
const (
	PortStatusBound   PortStatus = "bound"
	PortStatusUnbound PortStatus = "unbound"
	PortStatusActive  PortStatus = "active"
)

type PortTracker

type PortTracker interface {
	SetPortStatus(containerID string, bp BoundPort, status PortStatus)
}

type ResourcesMonitor

type ResourcesMonitor struct {
	Writer *metrics.VictoriaMetricsWriter `asm:"victoriametrics-writer"`
	Reader *metrics.VictoriaMetricsReader `asm:"victoriametrics-reader"`
	Log    *slog.Logger
}

func (*ResourcesMonitor) LastestUsage

func (m *ResourcesMonitor) LastestUsage(id string) (float64, uint64, error)

func (*ResourcesMonitor) Monitor

func (m *ResourcesMonitor) Monitor(ctx context.Context, id, cgroupPath string) error

func (*ResourcesMonitor) Setup

func (m *ResourcesMonitor) Setup(ctx context.Context) error

type StatusMonitor

type StatusMonitor struct {
	Log *slog.Logger
	// contains filtered or unexported fields
}

func (*StatusMonitor) EntityBoundPorts

func (s *StatusMonitor) EntityBoundPorts(entity string) ([]BoundPort, error)

func (*StatusMonitor) FindBoundPort

func (s *StatusMonitor) FindBoundPort(bp BoundPort) ([]*EntityStatus, error)

func (*StatusMonitor) Populated

func (s *StatusMonitor) Populated() error

func (*StatusMonitor) SetPortStatus

func (s *StatusMonitor) SetPortStatus(entity string, port BoundPort, status PortStatus)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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