Documentation
¶
Overview ¶
Package observe provides optional, vendor-neutral action lifecycle observation for Nexss Kernel.
Index ¶
Constants ¶
const ( KindExecuted = "executed" KindError = "error" KindRetry = "retry" KindCacheHit = "cache_hit" KindCacheMiss = "cache_miss" KindCanceled = "canceled" KindPanic = "panic" KindCoalesced = "coalesced" KindDeduplicated = "deduplicated" )
Lifecycle kind constants.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Time time.Time
Duration time.Duration
Kind string
Action string
ExecutionID string
TraceID string
SpanID string
Request any
Response any
Error error
Recovered any
Attempt int
}
Event is a structured observation emitted during an action execution lifecycle.
type JSONLSink ¶
type JSONLSink struct {
// contains filtered or unexported fields
}
JSONLSink emits bounded structured lifecycle records to w.
func NewJSONLSink ¶
NewJSONLSink creates a synchronized JSONL sink. Non-positive maxBytes defaults to 4096.
type MemorySink ¶
type MemorySink struct {
// contains filtered or unexported fields
}
MemorySink stores recent events up to Capacity in a thread-safe ring buffer. Intended for unit tests, local debugging, and CLI diagnostic inspection.
func NewMemorySink ¶
func NewMemorySink(capacity int) *MemorySink
func (*MemorySink) Events ¶
func (s *MemorySink) Events() []Event
Events returns a snapshot copy in oldest-to-newest order.
type MetricsSink ¶
type MetricsSink struct {
// contains filtered or unexported fields
}
MetricsSink aggregates lifecycle event counts in memory.
func NewMetricsSink ¶
func NewMetricsSink() *MetricsSink
NewMetricsSink creates an empty metrics sink.
func (*MetricsSink) Snapshot ¶
func (s *MetricsSink) Snapshot() map[MetricKey]uint64
Snapshot returns an isolated thread-safe copy of all counters.
type PrometheusSink ¶
type PrometheusSink struct {
// contains filtered or unexported fields
}
PrometheusSink aggregates lifecycle counters and formats text exposition output.
func NewPrometheusSink ¶
func NewPrometheusSink() *PrometheusSink
NewPrometheusSink creates a Prometheus text exporter sink.
func (*PrometheusSink) Snapshot ¶
func (s *PrometheusSink) Snapshot() map[MetricKey]uint64
Snapshot returns a copy of current metric counters.
func (*PrometheusSink) WritePrometheus ¶
func (s *PrometheusSink) WritePrometheus(w io.Writer) error
WritePrometheus writes deterministic Prometheus text exposition lines to w.
type SlogSink ¶
type SlogSink struct {
// contains filtered or unexported fields
}
SlogSink writes structured lifecycle events to a standard-library slog.Logger.
func NewSlogSink ¶
NewSlogSink creates a sink using logger. If logger is nil, slog.Default() is used.