Documentation
¶
Index ¶
Constants ¶
View Source
const ( MetricRecordsPerSecond = "rps" MetricKilobytesPerSecond = "kbps" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// Increment and Add are used to track and report metrics.
Increment func()
Add func(n uint64)
// contains filtered or unexported fields
}
Collector tracks and logs metrics such as request rate and counts within a context-managed environment.
func NewCollector ¶
func NewCollector(ctx context.Context, logger *slog.Logger, name, message string, enabled bool) *Collector
NewCollector initializes a new Collector with the provided context and logger, Enabled metrics will be reported to logger debug level.
func (*Collector) GetLastResult ¶
GetLastResult returns the last calculated RecordsPerSecond value.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps an io.Reader to collect metrics on read operations.
Click to show internal directories.
Click to hide internal directories.