Add go sdk

This commit is contained in:
Oliver
2026-01-06 14:55:21 +01:00
parent 32bcd6db9e
commit e018bedca3
21 changed files with 1090 additions and 0 deletions

34
httpmetrics/model.go Normal file
View File

@@ -0,0 +1,34 @@
package httpmetrics
import "net/http"
type StatusRecorder struct {
http.ResponseWriter
Status int
Size int64
}
func (s *StatusRecorder) WriteHeader(code int) {
s.Status = code
s.ResponseWriter.WriteHeader(code)
}
func (s *StatusRecorder) Write(b []byte) (int, error) {
n, err := s.ResponseWriter.Write(b)
s.Size += int64(n)
return n, err
}
type RequestMetrics struct {
RequestsPerSecond float64
StatusCodes map[string]int64
Durations Stats
RequestSizes Stats
ResponseSizes Stats
}
type Stats struct {
Min int64
Max int64
Avg float64
}