Documentation
¶
Overview ¶
Package agg is the shared aggregation core: a concurrency-safe, bounded key→latency table with log2-bucket histograms for approximate percentiles.
Index ¶
Constants ¶
View Source
const ( // DefaultMaxKeys bounds distinct keys per table. Observations for new // keys beyond the cap are merged into OverflowKey instead of being // silently dropped. DefaultMaxKeys = 10000 // OverflowKey is the merged bucket for observations past the key cap. OverflowKey = "(other)" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Key string `json:"key"`
Count int64 `json:"count"`
ErrorCount int64 `json:"error_count"`
Total time.Duration `json:"total_ns"`
Avg time.Duration `json:"avg_ns"`
Max time.Duration `json:"max_ns"`
P95 time.Duration `json:"p95_ns"`
}
Entry is one aggregated row of a Snapshot. Duration fields marshal to JSON as integer nanoseconds.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table aggregates durations by key. All methods are safe for concurrent use.
func (*Table) Observe ¶
Observe records one duration for key. New keys are reserved atomically so concurrent observations cannot exceed the configured normal-key budget.
func (*Table) ObserveResult ¶ added in v0.2.0
ObserveResult records one duration and whether the operation failed.
Click to show internal directories.
Click to hide internal directories.