Versions in this module Expand all Collapse all v0 v0.1.0 Dec 5, 2026 Changes in this version + const Day + const GCPause + const Goroutines + const HeapAlloc + const HeapInuse + const HistogramBins + const Hour + const Minute + const NumGC + const OtherKey + const Sys + var HistogramBounds = [HistogramBins - 1]time.Duration + var Periods = []time.Duration + var Window1h = Window + var Window24h = Window + var Window6h = Window + var Window7d = Window + var Windows = []Window + func DefaultRoute(r *http.Request) string + func Fingerprint(sql string) string + func HTTPMiddleware(rec *Recorder, opts ...HTTPOption) func(http.Handler) http.Handler + func NewTransport(rec *Recorder, base http.RoundTripper) http.RoundTripper + func NormalizePath(p string) string + func Series(buckets []Bucket, w Window, now time.Time, value func(Stats) int64) []int64 + func TrackCache[V any](r *Recorder, keyPrefix string, get func() (V, bool)) (V, bool) + func WrapHTTPClient(rec *Recorder, c *http.Client) *http.Client + type Batch struct + Buckets []Bucket + Entries []Entry + Exceptions []ExceptionSample + type Bucket struct + ClientErrors int64 + Count int64 + Failed int64 + Hist Histogram + Key string + Last int64 + Max int64 + Metric Metric + Period time.Duration + Slow int64 + Start time.Time + Sum int64 + func (b *Bucket) Merge(o *Bucket) + type Entry struct + At time.Time + Detail string + Duration time.Duration + Key string + Metric Metric + type ExceptionGroup struct + Total int64 + type ExceptionSample struct + Count int64 + Fingerprint string + FirstSeen time.Time + LastSeen time.Time + Location string + Message string + Stack []Frame + Type string + type Frame struct + App bool + File string + Func string + Line int + type HTTPOption func(*httpConfig) + func WithIgnorePaths(prefixes ...string) HTTPOption + func WithRoute(fn func(*http.Request) string) HTTPOption + type Histogram [HistogramBins]int64 + func (h *Histogram) Add(d time.Duration, n int64) + func (h *Histogram) Merge(o *Histogram) + func (h Histogram) Quantile(q float64, limit time.Duration) time.Duration + func (h Histogram) Total() int64 + type MemoryOption func(*MemoryStore) + func WithEntryLimit(n int) MemoryOption + func WithExceptionLimit(n int) MemoryOption + func WithRetention(d time.Duration) MemoryOption + func WithStoreClock(now func() time.Time) MemoryOption + type MemoryStore struct + func NewMemoryStore(opts ...MemoryOption) *MemoryStore + func (s *MemoryStore) Exceptions(_ context.Context, q Query) ([]ExceptionGroup, error) + func (s *MemoryStore) PruneBefore(_ context.Context, t time.Time) error + func (s *MemoryStore) QueryRollups(_ context.Context, q Query) ([]Bucket, error) + func (s *MemoryStore) TopSlow(_ context.Context, q Query) ([]SlowGroup, error) + func (s *MemoryStore) WriteBuckets(_ context.Context, b *Batch) error + type Metric string + const Cache + const Exceptions + const Jobs + const Outbound + const Queries + const QueueDepth + const Requests + const Runtime + type Option func(*config) + func WithBufferSize(n int) Option + func WithClock(now func() time.Time) Option + func WithFlushInterval(d time.Duration) Option + func WithFrameworkPackages(prefixes ...string) Option + func WithLogger(l *slog.Logger) Option + func WithMaxEntries(n int) Option + func WithMaxKeys(n int) Option + func WithSampleRate(r float64) Option + func WithSlowThreshold(m Metric, d time.Duration) Option + type Overview struct + Cache Stats + Exceptions int64 + Goroutines int64 + HeapInuse int64 + Jobs Stats + Outbound Stats + PerMinute float64 + Queries Stats + QueueDepth int64 + RequestTrend []int64 + Requests Stats + Window Window + func LoadOverview(ctx context.Context, s Store, w Window, now time.Time) (*Overview, error) + type PanicError struct + Value any + func (e *PanicError) Error() string + func (e *PanicError) Unwrap() error + type Query struct + From time.Time + Key string + Limit int + Metric Metric + Period time.Duration + To time.Time + func (q Query) LimitOr(def int) int + type Recorder struct + func New(store Store, opts ...Option) *Recorder + func (r *Recorder) Close(ctx context.Context) error + func (r *Recorder) Dropped() uint64 + func (r *Recorder) FailedFlushes() uint64 + func (r *Recorder) Flush(ctx context.Context) error + func (r *Recorder) RecordCache(op, keyPrefix string, hit bool) + func (r *Recorder) RecordException(_ context.Context, err error, stack []byte) + func (r *Recorder) RecordJob(queue, kind string, d time.Duration, err error) + func (r *Recorder) RecordOutbound(method, host string, status int, d time.Duration, err error) + func (r *Recorder) RecordQuery(_ context.Context, sql string, d time.Duration, err error) + func (r *Recorder) RecordQueueDepth(queue string, depth int64) + func (r *Recorder) RecordRequest(route string, status int, d time.Duration, detail string) + func (r *Recorder) SampleRate() float64 + func (r *Recorder) SampleRuntime() + func (r *Recorder) SlowThreshold(m Metric) time.Duration + func (r *Recorder) Start(ctx context.Context) + func (r *Recorder) StartRuntimeSampler(ctx context.Context, interval time.Duration) + func (r *Recorder) Store() Store + type SlowGroup struct + Count int64 + Detail string + Key string + Last time.Time + Max time.Duration + type Stats struct + ClientErrors int64 + Count int64 + Failed int64 + Hist Histogram + Key string + Last int64 + LastAt time.Time + Max int64 + Samples int64 + Slow int64 + Sum int64 + func Summarize(buckets []Bucket) []Stats + func Total(buckets []Bucket) Stats + func (s Stats) Avg() time.Duration + func (s Stats) FailRate() float64 + func (s Stats) MaxDuration() time.Duration + func (s Stats) Quantile(q float64) time.Duration + type Store interface + Exceptions func(ctx context.Context, q Query) ([]ExceptionGroup, error) + PruneBefore func(ctx context.Context, t time.Time) error + QueryRollups func(ctx context.Context, q Query) ([]Bucket, error) + TopSlow func(ctx context.Context, q Query) ([]SlowGroup, error) + WriteBuckets func(ctx context.Context, b *Batch) error + type Window struct + Key string + Label string + Period time.Duration + Span time.Duration + func ParseWindow(key string) Window + func (w Window) Query(m Metric, now time.Time) Query