Files
styx/proxy/stats.go
2025-09-30 08:08:22 +02:00

20 lines
394 B
Go

package proxy
import (
"expvar"
"strconv"
"git.maze.io/maze/styx/db/stats"
)
func countStatus(code int) {
k := "http:status:" + strconv.Itoa(code)
v := expvar.Get(k)
if v == nil {
//v = stats.NewCounter("120s1s", "15m10s", "1h1m", "4w1d", "1y4w")
v = stats.NewCounter(k, stats.Minutely, stats.Hourly, stats.Daily, stats.Yearly)
expvar.Publish(k, v)
}
v.(stats.Metric).Add(1)
}