observability

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 18 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)

Types

type BoundPort

type BoundPort struct {
	Addr netip.Addr
	Port int
}

type DebugLogWriter

type DebugLogWriter struct {
	Log *slog.Logger
}

func NewDebugLogWriter added in v0.3.0

func NewDebugLogWriter(log *slog.Logger) *DebugLogWriter

NewDebugLogWriter creates a new DebugLogWriter.

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
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewLogReader added in v0.3.0

func NewLogReader(address string, timeout time.Duration) *LogReader

NewLogReader creates a new LogReader.

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
	Filter    string // Optional LogsQL filter expression (e.g., "error" or ~"regex")
}

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

func (LogTarget) Query added in v0.2.0

func (t LogTarget) Query() string

Query returns the LogsQL query string for this target.

type LogWriter

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

type LogsMaintainer

type LogsMaintainer struct {
}

func NewLogsMaintainer added in v0.3.0

func NewLogsMaintainer() *LogsMaintainer

NewLogsMaintainer creates a new LogsMaintainer.

func (*LogsMaintainer) Setup

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

type PersistentLogReader

type PersistentLogReader struct {
	Address string
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewPersistentLogReader added in v0.3.0

func NewPersistentLogReader(address string, timeout time.Duration) *PersistentLogReader

NewPersistentLogReader creates a new PersistentLogReader.

func (*PersistentLogReader) Read

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

type PersistentLogWriter

type PersistentLogWriter struct {
	Address string
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewPersistentLogWriter added in v0.3.0

func NewPersistentLogWriter(address string, timeout time.Duration) *PersistentLogWriter

NewPersistentLogWriter creates a new PersistentLogWriter.

func (*PersistentLogWriter) Client

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

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 {
	Log    *slog.Logger
	Writer *metrics.VictoriaMetricsWriter
	Reader *metrics.VictoriaMetricsReader
}

func NewResourcesMonitor added in v0.3.0

func NewResourcesMonitor(log *slog.Logger, writer *metrics.VictoriaMetricsWriter, reader *metrics.VictoriaMetricsReader) *ResourcesMonitor

NewResourcesMonitor creates a new ResourcesMonitor.

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 NewStatusMonitor added in v0.3.0

func NewStatusMonitor(log *slog.Logger) *StatusMonitor

NewStatusMonitor creates a new StatusMonitor.

func (*StatusMonitor) EntityBoundPorts

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

func (*StatusMonitor) FindBoundPort

func (s *StatusMonitor) FindBoundPort(bp BoundPort) ([]*EntityStatus, 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