| 1 | package httperror |
| 2 | |
| 3 | import ( |
| 4 | "net/http" |
| 5 | "strconv" |
| 6 | |
| 7 | "github.com/prometheus/client_golang/prometheus" |
| 8 | ) |
| 9 | |
| 10 | func Error(w http.ResponseWriter, r *http.Request, error string, code int, httpReqs *prometheus.CounterVec) { |
| 11 | http.Error(w, error, code) |
| 12 | httpReqs.WithLabelValues(strconv.Itoa(code), r.Method).Add(1) |
| 13 | } |