mirror of
https://github.com/cubixle/groxy.git
synced 2026-04-30 17:38:38 +01:00
init
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
var requestCounter *prometheus.CounterVec
|
||||
|
||||
func init() {
|
||||
requestCounter = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "request_counter",
|
||||
Help: "A counter of total requests by status code",
|
||||
}, []string{"code", "method"})
|
||||
}
|
||||
|
||||
func RequestInc(statusCode int, method string) {
|
||||
requestCounter.With(prometheus.Labels{"code": strconv.Itoa(statusCode), "method": method}).Inc()
|
||||
}
|
||||
Reference in New Issue
Block a user