Documentation
¶
Index ¶
Constants ¶
This section is empty.
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, metricType MetricType, 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 MetricType ¶
type MetricType int
const ( RecordsPerSecond MetricType = iota KilobytesPerSecond )
func (MetricType) String ¶
func (mt MetricType) String() string
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.