Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

segmentio/go-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

23 Commits

Repository files navigation

go-stats

Note
Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.

Go stats reporting / ticker utility.

View the docs.

Example

package main
import "github.com/segmentio/go-stats"
import "time"
func main() {
 s := stats.New()
 go func() {
 for {
 s.IncrBy("messages", 5)
 s.Incr("errors")
 time.Sleep(50 * time.Millisecond)
 }
 }()
 s.TickEvery(5 * time.Second)
 defer s.Stop()
 time.Sleep(time.Minute)
}

Outputs the ops/s, since last tick, and since the beginning of time.

stats 2014年07月18日 11:24:27 messages 94.00/s tick=470 total=470
stats 2014年07月18日 11:24:27 errors 18.80/s tick=94 total=94
stats 2014年07月18日 11:24:32 messages 96.98/s tick=485 total=955
stats 2014年07月18日 11:24:32 errors 19.40/s tick=97 total=191
stats 2014年07月18日 11:24:37 messages 98.99/s tick=495 total=1450
stats 2014年07月18日 11:24:37 errors 19.80/s tick=99 total=290
...

License

MIT

About

Go stats ticker utility

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

Languages

AltStyle によって変換されたページ (->オリジナル) /