https://github.com/adnaan/statsdwrap
A http handler wrapper for statsd
https://github.com/adnaan/statsdwrap
http middleware statsd
Last synced: about 1 year ago
JSON representation
A http handler wrapper for statsd
- Host: GitHub
- URL: https://github.com/adnaan/statsdwrap
- Owner: adnaan
- Created: 2017-07-20T10:28:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-20T10:31:18.000Z (over 8 years ago)
- Last Synced: 2025-02-27T00:51:39.555Z (about 1 year ago)
- Topics: http, middleware, statsd
- Language: Go
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Usage:
```go
r := chi.NewRouter()
statsdClient, _ := statsd.New(
statsd.Prefix("myapp"),
statsd.Address("localhost:8125"),
)
wrap := statsdwrap.NewChi("user_service", statsdClient)
handleHome := func(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Millisecond * 1000)
w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
}
r.Get(wrap.HandlerFunc("home", "/", handleHome))
```