statscollector

package
v0.0.239 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stats

type Stats struct {
	Min   time.Duration
	Max   time.Duration
	Sum   time.Duration
	Count int64
}

type StatsCollector

type StatsCollector struct {
	// contains filtered or unexported fields
}

func NewStatsCollector

func NewStatsCollector() *StatsCollector

func (*StatsCollector) GetStats

func (sc *StatsCollector) GetStats(reset bool) map[string]map[string]Stats

GetStats returns a snapshot of the current statistics. If reset is true, statistics are cleared after reading.

func (*StatsCollector) Handler

func (sc *StatsCollector) Handler(next http.Handler) http.Handler

Handler returns a middleware that collects timing statistics for the downstream handler chain. It should be attached as close as possible to the actual API logic in the handler chain to measure only the core API logic execution time (excluding upstream middleware).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL