Registry / utility / paulbellamy-ratecounter

paulbellamy-ratecounter

JSON →
library0.2.0gogounverified

A thread-safe rate counter for tracking counts in an interval, useful for requests-per-second statistics.

go get github.com/paulbellamy/ratecounter
INSTALL
IMPORT
SIG · PAULBELLAMY-RATECO
P
paulbellamy-ratecounter
utilitygov0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ratecounter
github.com/paulbellamy/ratecounter

Creates a rate counter with a 1-second window, increments it, and prints the current rate.

package main import ( "fmt" "time" "github.com/paulbellamy/ratecounter" ) func main() { counter := ratecounter.NewRateCounter(1 * time.Second) counter.Incr(1) fmt.Printf("Rate: %d\n", counter.Rate()) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.2.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
paulbellamy-ratecounter — go get paulbellamy-ratecounter · libregistry