Documentation
¶
Index ¶
Constants ¶
const ( KindSuccess = "success" KindError = "error" KindTimeout = "timeout" KindRetry = "retry" KindCacheHit = "cache_hit" KindCacheMiss = "cache_miss" KindCanceled = "canceled" KindPanic = "panic" KindCoalesced = "coalesced" KindDeduplicated = "deduplicated" )
const ( // MaxMetricKeys bounds the number of distinct counters retained by MetricsSink. MaxMetricKeys = 10_000 // MaxMetricLabelBytes bounds each action and kind label retained by MetricsSink. MaxMetricLabelBytes = 128 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JSONLSink ¶
type JSONLSink struct {
// contains filtered or unexported fields
}
func NewJSONLSink ¶
NewJSONLSink accepts but ignores the legacy size argument; raw diagnostics are redacted.
type MemorySink ¶
type MemorySink struct {
// contains filtered or unexported fields
}
func NewMemorySink ¶
func NewMemorySink(capacity int) *MemorySink
func (*MemorySink) Events ¶
func (s *MemorySink) Events() []Event
type MetricsSink ¶
type MetricsSink struct {
// contains filtered or unexported fields
}
MetricsSink aggregates lifecycle event counts in memory. Events exceeding the key or label limits are counted by OverflowCount instead of retained.
func NewMetricsSink ¶
func NewMetricsSink() *MetricsSink
NewMetricsSink creates an empty metrics sink.
func (*MetricsSink) OverflowCount ¶ added in v0.37.0
func (s *MetricsSink) OverflowCount() uint64
OverflowCount returns events not retained because a key or label exceeded the configured metrics bounds.
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
}
func NewPrometheusSink ¶
func NewPrometheusSink() *PrometheusSink
func (*PrometheusSink) OverflowCount ¶ added in v0.37.0
func (s *PrometheusSink) OverflowCount() uint64
OverflowCount returns events omitted from the per-key snapshot due to metrics bounds.
func (*PrometheusSink) Snapshot ¶
func (s *PrometheusSink) Snapshot() map[MetricKey]uint64
func (*PrometheusSink) WritePrometheus ¶
func (s *PrometheusSink) WritePrometheus(w io.Writer) error
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.