From 19eaeceb7e0ee10316d9130dcae03b8f0f957b80 Mon Sep 17 00:00:00 2001 From: Cedric Lewe <43417046+QuByte-Zer0@users.noreply.github.com> Date: Thu, 9 Apr 2020 02:41:29 +0200 Subject: [PATCH] Metrics: fix mismatch --- server/metrics.go | 6 +++--- server/server.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/metrics.go b/server/metrics.go index 1aca9ea..524bec5 100644 --- a/server/metrics.go +++ b/server/metrics.go @@ -12,14 +12,14 @@ var ( }, []string{"route"}, ) - metricsErrors = prometheus.NewCounterVec( + metricsErrorsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "qumine_ingress_errors_total", Help: "The total error count", }, []string{"error"}, ) - metricsBytes = prometheus.NewCounterVec( + metricsBytesTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "qumine_ingress_bytes_total", Help: "The total bytes transmitted", @@ -30,5 +30,5 @@ var ( func init() { prometheus.MustRegister(metricsConnections) - prometheus.MustRegister(metricsBytes) + prometheus.MustRegister(metricsBytesTotal) } diff --git a/server/server.go b/server/server.go index b3d9e86..5d13766 100644 --- a/server/server.go +++ b/server/server.go @@ -141,7 +141,7 @@ func (server *Server) findAndConnectBackend(context context.Context, client net. route, err := ReadRoute(hostname) if err != nil { logrus.WithError(err).Warn("no matching route found") - metricsConnections.With(prometheus.Labels{"error": "no route found"}).Inc() + metricsErrorsTotal.With(prometheus.Labels{"error": "no route found"}).Inc() return } logrus.WithFields(logrus.Fields{ @@ -155,7 +155,7 @@ func (server *Server) findAndConnectBackend(context context.Context, client net. "client": client.RemoteAddr(), "route": route, }).Error("connecting to upstream failed") - metricsConnections.With(prometheus.Labels{"error": "coonection failed"}).Inc() + metricsErrorsTotal.With(prometheus.Labels{"error": "coonection failed"}).Inc() return } defer metricsConnections.With(prometheus.Labels{"route": route}).Dec() @@ -221,7 +221,7 @@ func (server *Server) relayConnections(context context.Context, route string, cl func (server *Server) relay(incoming io.Reader, outgoing io.Writer, errors chan<- error, direction string, route string, client net.Conn, upstream net.Conn) { amount, err := io.Copy(outgoing, incoming) - metricsBytes.With(prometheus.Labels{"direction": direction, "route": route}).Add(float64(amount)) + metricsBytesTotal.With(prometheus.Labels{"direction": direction, "route": route}).Add(float64(amount)) logrus.WithFields(logrus.Fields{ "client": client.RemoteAddr(), "upstream": upstream.RemoteAddr(),