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 ¶
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) 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 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.