events

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package events defines telemetry events and a broadcast channel for distributing them to multiple consumers (dashboard WebSocket, log UI, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectLogLevel

func DetectLogLevel(text string) string

DetectLogLevel infers a log severity from common patterns in the log text.

Types

type Broadcaster

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

Broadcaster distributes events to an unbounded set of subscribers. Slow subscribers are not blocked — they receive the event asynchronously via a buffered channel.

func (*Broadcaster) Close

func (b *Broadcaster) Close()

Close closes all subscriber channels.

func (*Broadcaster) Send

func (b *Broadcaster) Send(ev TelemetryEvent)

Send delivers an event to all current subscribers, dropping it for any subscriber whose buffer is full (non-blocking).

func (*Broadcaster) Subscribe

func (b *Broadcaster) Subscribe(cap int) <-chan TelemetryEvent

Subscribe returns a channel that will receive future events. The caller owns the channel and must drain it promptly; cap controls the buffer depth.

func (*Broadcaster) Unsubscribe

func (b *Broadcaster) Unsubscribe(ch <-chan TelemetryEvent)

Unsubscribe removes a previously subscribed channel and closes it.

type LogLine

type LogLine struct {
	Service  string
	Text     string
	IsStderr bool
	Level    string
}

LogLine is a structured log line emitted by a supervised service.

type ServiceStatusKind

type ServiceStatusKind int
const (
	KindServiceStatusChange ServiceStatusKind = iota
	KindLogRecord
	KindTraceUpdate
	KindMetricUpdate
)

type TelemetryEvent

type TelemetryEvent struct {
	Kind ServiceStatusKind

	// ServiceStatusChange fields
	Service string
	Status  string

	// LogRecord fields (also set Service)
	LogBody     string
	LogSeverity string
	TraceID     string
	SpanID      string

	// TraceUpdate / MetricUpdate carry their data as raw JSON to be forwarded
	// to WebSocket clients unchanged.
	RawJSON []byte
}

TelemetryEvent is the discriminated union of events emitted by the orchestrator.

Jump to

Keyboard shortcuts

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