From 7904ea4af272ad92f380b8a2920b1d893017d244 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Sun, 24 Jan 2021 16:03:36 +0100 Subject: [PATCH] Update netdev OpenBSD amd64 filter Use new filtering method from #1826 Signed-off-by: Ben Kochie --- collector/netdev_openbsd_amd64.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/collector/netdev_openbsd_amd64.go b/collector/netdev_openbsd_amd64.go index ec822694..47f2a36e 100644 --- a/collector/netdev_openbsd_amd64.go +++ b/collector/netdev_openbsd_amd64.go @@ -20,11 +20,10 @@ import ( "github.com/go-kit/kit/log/level" "golang.org/x/sys/unix" - "regexp" "unsafe" ) -func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp, logger log.Logger) (netDevStats, error) { +func getNetDevStats(filter *netDevFilter, logger log.Logger) (netDevStats, error) { netDev := netDevStats{} mib := [6]_C_int{unix.CTL_NET, unix.AF_ROUTE, 0, 0, unix.NET_RT_IFLIST, 0} @@ -53,11 +52,7 @@ func getNetDevStats(ignore *regexp.Regexp, accept *regexp.Regexp, logger log.Log } data := ifm.Data dev := int8ToString(dl.Data[:dl.Nlen]) - if ignore != nil && ignore.MatchString(dev) { - level.Debug(logger).Log("msg", "Ignoring device", "device", dev) - continue - } - if accept != nil && !accept.MatchString(dev) { + if filter.ignored(dev) { level.Debug(logger).Log("msg", "Ignoring device", "device", dev) continue }