Registry / observability / felixge-httpsnoop

felixge-httpsnoop

JSON →
library1.1.0gogounverified

Package httpsnoop provides an easy way to capture HTTP-related metrics such as response time and status code by wrapping http.ResponseWriter.

go get github.com/felixge/httpsnoop
INSTALL
IMPORT
SIG · FELIXGE-HTTPSNOOP
F
felixge-httpsnoop
observabilitygov1.1.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.

httpsnoop
✓ github.com/felixge/httpsnoop

Wraps an HTTP handler to capture metrics like status code and duration.

package main import ( "fmt" "net/http" "github.com/felixge/httpsnoop" ) func myHandler(w http.ResponseWriter, r *http.Request) { m := httpsnoop.CaptureMetrics(w, func(w http.ResponseWriter) { w.Write([]byte("Hello")) }) fmt.Printf("Status: %d, Duration: %v\n", m.Code, m.Duration) } func main() { http.HandleFunc("/", myHandler) http.ListenAndServe(":8080", nil) }
Debug
Known issues

No known issues recorded.

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

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
16
OpenAI (training)
2
Amazon
1
Resources
felixge-httpsnoop — go get felixge-httpsnoop · libregistry