From 2b4254d01fcfe8f3fd7c62c12dfb5dbe5cf018a5 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 15 Jul 2019 22:58:00 +0300 Subject: [PATCH] app/vminsert: use netutil.TCPListener for collecting network-related metrics for Graphite and OpenTSDB TCP traffic --- app/vminsert/graphite/server.go | 3 ++- app/vminsert/opentsdb/server.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/vminsert/graphite/server.go b/app/vminsert/graphite/server.go index 38abb5afe..f93404dd2 100644 --- a/app/vminsert/graphite/server.go +++ b/app/vminsert/graphite/server.go @@ -10,6 +10,7 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/auth" "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/netutil" "github.com/VictoriaMetrics/metrics" ) @@ -24,7 +25,7 @@ var ( // Serve starts graphite server on the given addr. func Serve(addr string) { logger.Infof("starting TCP Graphite server at %q", addr) - lnTCP, err := net.Listen("tcp4", addr) + lnTCP, err := netutil.NewTCPListener("graphite", addr) if err != nil { logger.Fatalf("cannot start TCP Graphite server at %q: %s", addr, err) } diff --git a/app/vminsert/opentsdb/server.go b/app/vminsert/opentsdb/server.go index d39f524b3..302c1fde2 100644 --- a/app/vminsert/opentsdb/server.go +++ b/app/vminsert/opentsdb/server.go @@ -10,6 +10,7 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/lib/auth" "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/netutil" "github.com/VictoriaMetrics/metrics" ) @@ -24,7 +25,7 @@ var ( // Serve starts OpenTSDB collector on the given addr. func Serve(addr string) { logger.Infof("starting TCP OpenTSDB collector at %q", addr) - lnTCP, err := net.Listen("tcp4", addr) + lnTCP, err := netutil.NewTCPListener("opentsdb", addr) if err != nil { logger.Fatalf("cannot start TCP OpenTSDB collector at %q: %s", addr, err) }