Date: Wed, 13 Mar 2024 16:39:16 GMT From: Ryan Steinmetz <zi@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: f2ba6478d518 - main - net-mgmt/nsd_exporter: Update to 0.3.1 Message-ID: <202403131639.42DGdG7f000118@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by zi: URL: https://cgit.FreeBSD.org/ports/commit/?id=f2ba6478d518401dabd0b290d82ddb4a9a2bc43a commit f2ba6478d518401dabd0b290d82ddb4a9a2bc43a Author: Ryan Steinmetz <zi@FreeBSD.org> AuthorDate: 2024-03-13 16:39:05 +0000 Commit: Ryan Steinmetz <zi@FreeBSD.org> CommitDate: 2024-03-13 16:39:05 +0000 net-mgmt/nsd_exporter: Update to 0.3.1 --- net-mgmt/nsd_exporter/Makefile | 27 ++-- net-mgmt/nsd_exporter/distinfo | 46 +++--- net-mgmt/nsd_exporter/files/patch-nsd__exporter.go | 163 --------------------- 3 files changed, 40 insertions(+), 196 deletions(-) diff --git a/net-mgmt/nsd_exporter/Makefile b/net-mgmt/nsd_exporter/Makefile index 62e9bb30a01d..b164a8353a89 100644 --- a/net-mgmt/nsd_exporter/Makefile +++ b/net-mgmt/nsd_exporter/Makefile @@ -1,6 +1,6 @@ PORTNAME= nsd_exporter -PORTVERSION= 0.1.0 -PORTREVISION= 19 +PORTVERSION= 0.3.1 +DISTVERSIONPREFIX= v CATEGORIES= net-mgmt MAINTAINER= zi@FreeBSD.org @@ -13,15 +13,18 @@ USES= go USE_GITHUB= yes GH_ACCOUNT= optix2000 -GH_TUPLE= prometheus:client_golang:v0.8.0:client_golang/vendor/github.com/prometheus/client_golang \ - prometheus:client_model:5c3871d:client_model/vendor/github.com/prometheus/client_model \ - prometheus:procfs:ae68e2d:procfs/vendor/github.com/prometheus/procfs \ - prometheus:common:7600349:common/vendor/github.com/prometheus/common \ - beorn7:perks:3a771d9:perks/vendor/github.com/beorn7/perks \ - golang:protobuf:70b3af3:protobuf/vendor/github.com/golang/protobuf \ - matttproud:golang_protobuf_extensions:c12348c:golang_protobuf_extensions/vendor/github.com/matttproud/golang_protobuf_extensions \ - optix2000:go-nsdctl:ce14b32:go_nsdctl/vendor/github.com/optix2000/go-nsdctl \ - go-yaml:yaml:7f97868:go_yaml/vendor/gopkg.in/yaml.v2 +GH_TUPLE= \ + beorn7:perks:v1.0.1:beorn7_perks/vendor/github.com/beorn7/perks \ + cespare:xxhash:v2.1.1:cespare_xxhash_v2/vendor/github.com/cespare/xxhash/v2 \ + go-yaml:yaml:v2.2.8:go_yaml_yaml/vendor/gopkg.in/yaml.v2 \ + golang:protobuf:v1.3.2:golang_protobuf/vendor/github.com/golang/protobuf \ + golang:sys:e047566fdf82:golang_sys/vendor/golang.org/x/sys \ + matttproud:golang_protobuf_extensions:v1.0.1:matttproud_golang_protobuf_extensions/vendor/github.com/matttproud/golang_protobuf_extensions \ + optix2000:go-nsdctl:v1.0.0:optix2000_go_nsdctl/vendor/github.com/optix2000/go-nsdctl \ + prometheus:client_golang:v1.4.0:prometheus_client_golang/vendor/github.com/prometheus/client_golang \ + prometheus:client_model:v0.2.0:prometheus_client_model/vendor/github.com/prometheus/client_model \ + prometheus:common:v0.9.1:prometheus_common/vendor/github.com/prometheus/common \ + prometheus:procfs:v0.0.8:prometheus_procfs/vendor/github.com/prometheus/procfs GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME} @@ -30,7 +33,7 @@ PLIST_FILES= bin/nsd_exporter USE_RC_SUBR= nsd_exporter post-patch: - ${REINPLACE_CMD} -e 's|"/etc|"${LOCALBASE}/etc|g' ${WRKSRC_go_nsdctl}/nsdctl.go + ${REINPLACE_CMD} -e 's|"/etc|"${LOCALBASE}/etc|g' ${WRKSRC_optix2000_go_nsdctl}/nsdctl.go ${REINPLACE_CMD} -e 's|"/etc|"${LOCALBASE}/etc|g' ${WRKSRC}/nsd_exporter.go .include <bsd.port.mk> diff --git a/net-mgmt/nsd_exporter/distinfo b/net-mgmt/nsd_exporter/distinfo index cf4cdb8e8e91..f2e8b4a78fef 100644 --- a/net-mgmt/nsd_exporter/distinfo +++ b/net-mgmt/nsd_exporter/distinfo @@ -1,21 +1,25 @@ -TIMESTAMP = 1553011211 -SHA256 (optix2000-nsd_exporter-0.1.0_GH0.tar.gz) = 7fb9fae9f434e904e79eceaef9e5640e8be66d57384f87a9a6a85ab663dcf51c -SIZE (optix2000-nsd_exporter-0.1.0_GH0.tar.gz) = 8144 -SHA256 (prometheus-client_golang-v0.8.0_GH0.tar.gz) = 88b0040393276116f848de5bdd636717d339667273cfc45a4edda40b5e5682bd -SIZE (prometheus-client_golang-v0.8.0_GH0.tar.gz) = 75593 -SHA256 (prometheus-client_model-5c3871d_GH0.tar.gz) = 5decfffcc4a7cfbce4214e42aaf0e3af9acdadf5d3f3ef6733868314171fd2f0 -SIZE (prometheus-client_model-5c3871d_GH0.tar.gz) = 57126 -SHA256 (prometheus-procfs-ae68e2d_GH0.tar.gz) = d2ef0107607a9e0fcfccbe7d0a364ea04de741d464b244994fb579f2610dfb4f -SIZE (prometheus-procfs-ae68e2d_GH0.tar.gz) = 57790 -SHA256 (prometheus-common-7600349_GH0.tar.gz) = 428d2301007b765ae36a64114b2f4806556c602dba34c011a10caaae76cbb433 -SIZE (prometheus-common-7600349_GH0.tar.gz) = 77805 -SHA256 (beorn7-perks-3a771d9_GH0.tar.gz) = b7a0faebca98ebd5e7546403b4cdea9dc77f865f0623d04efbad33e984297cc9 -SIZE (beorn7-perks-3a771d9_GH0.tar.gz) = 10800 -SHA256 (golang-protobuf-70b3af3_GH0.tar.gz) = fd81970d30eba8f3d49c5b27eb80728060f022bb391515e8d79724d5b39dc1f9 -SIZE (golang-protobuf-70b3af3_GH0.tar.gz) = 329777 -SHA256 (matttproud-golang_protobuf_extensions-c12348c_GH0.tar.gz) = da165c9275b77a0994b815bc7d761dcb2e4799a90fe49eec08d8bdff3a683f48 -SIZE (matttproud-golang_protobuf_extensions-c12348c_GH0.tar.gz) = 37200 -SHA256 (optix2000-go-nsdctl-ce14b32_GH0.tar.gz) = 4474f6e9f18d08035f36ef60dc25b97c7c5528ab99f59cf7f94854613d73b239 -SIZE (optix2000-go-nsdctl-ce14b32_GH0.tar.gz) = 4038 -SHA256 (go-yaml-yaml-7f97868_GH0.tar.gz) = b0215657c82db81fa1e10f73fb1df3db12715ec68a14ab555e7f40d1d174132d -SIZE (go-yaml-yaml-7f97868_GH0.tar.gz) = 69163 +TIMESTAMP = 1710347333 +SHA256 (optix2000-nsd_exporter-v0.3.1_GH0.tar.gz) = 5d95ed41b3e3b3b4ebead82951e16d100977d2aa89c4970f5d7422936558afe6 +SIZE (optix2000-nsd_exporter-v0.3.1_GH0.tar.gz) = 13292 +SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825 +SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867 +SHA256 (cespare-xxhash-v2.1.1_GH0.tar.gz) = 0ee31178d2c5a1249be4e26294a2f428008dc4e1ecbbfbe47f74e41026df1148 +SIZE (cespare-xxhash-v2.1.1_GH0.tar.gz) = 9292 +SHA256 (go-yaml-yaml-v2.2.8_GH0.tar.gz) = 9632d0760e9a07c414f2b2b6cd453d6225e42ecea77906883b23f1f1d0546045 +SIZE (go-yaml-yaml-v2.2.8_GH0.tar.gz) = 72732 +SHA256 (golang-protobuf-v1.3.2_GH0.tar.gz) = c9cda622857a17cf0877c5ba76688a931883e505f40744c9495638b6e3da1f65 +SIZE (golang-protobuf-v1.3.2_GH0.tar.gz) = 312285 +SHA256 (golang-sys-e047566fdf82_GH0.tar.gz) = efdcc83f41376bfb46c4337ecd1bdcbe88c7b7c1d93a191e67b0b7b44ad08c2a +SIZE (golang-sys-e047566fdf82_GH0.tar.gz) = 1535022 +SHA256 (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 2def0ee6f6b12b1efc0e3007d89f598608a072610e805c3655ea9d13c3ead49b +SIZE (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 37184 +SHA256 (optix2000-go-nsdctl-v1.0.0_GH0.tar.gz) = f2f8afd51b7b9f951cff4d4a27f37f8fdc2309966eb4f22df3b156abebd6d7f7 +SIZE (optix2000-go-nsdctl-v1.0.0_GH0.tar.gz) = 4083 +SHA256 (prometheus-client_golang-v1.4.0_GH0.tar.gz) = b18eba6dc84cb794aec326fac43879d39e6b1b00e70c5aefb8cf3bcccb447e03 +SIZE (prometheus-client_golang-v1.4.0_GH0.tar.gz) = 148353 +SHA256 (prometheus-client_model-v0.2.0_GH0.tar.gz) = 4ab1be9cdfa702d7f49beeb09a256bcc6a2aad55e8a0a37e7732a46934264e12 +SIZE (prometheus-client_model-v0.2.0_GH0.tar.gz) = 10986 +SHA256 (prometheus-common-v0.9.1_GH0.tar.gz) = a36c6c9ad9da26e20fe7b0a3b0ffe6d3b6d30695289a2caf4d4bdad11620c91c +SIZE (prometheus-common-v0.9.1_GH0.tar.gz) = 107014 +SHA256 (prometheus-procfs-v0.0.8_GH0.tar.gz) = 1c26c8b86a9b1902684f860f94d0bf4b94abcc570e456bf9a74d1c9d83643872 +SIZE (prometheus-procfs-v0.0.8_GH0.tar.gz) = 126299 diff --git a/net-mgmt/nsd_exporter/files/patch-nsd__exporter.go b/net-mgmt/nsd_exporter/files/patch-nsd__exporter.go deleted file mode 100644 index b3513cc95f75..000000000000 --- a/net-mgmt/nsd_exporter/files/patch-nsd__exporter.go +++ /dev/null @@ -1,163 +0,0 @@ ---- nsd_exporter.go.orig 2018-02-08 23:45:14 UTC -+++ nsd_exporter.go -@@ -5,6 +5,7 @@ package main - import ( - "bufio" - "flag" -+ "fmt" - "log" - "net/http" - "strconv" -@@ -58,10 +59,20 @@ func (c *NSDCollector) Collect(ch chan<- - s := bufio.NewScanner(r) - for s.Scan() { - line := strings.Split(s.Text(), "=") -- metricName := line[0] -+ metricName := strings.TrimSpace(line[0]) - m, ok := c.metrics[metricName] - if !ok { -- log.Println("Unknown Metric ", metricName, ". Skipping.") -+ log.Println("New metric " + metricName + " found. Refreshing.") -+ // Try to update the metrics list -+ err = c.updateMetric(s.Text()) -+ if err != nil { -+ log.Println(err.Error()) -+ } -+ // Refetch metric -+ m, ok = c.metrics[metricName] -+ if !ok { -+ log.Println("Metric " + metricName + "not configured. Skipping") -+ } - continue - } - value, err := strconv.ParseFloat(line[1], 64) -@@ -84,7 +95,57 @@ func (c *NSDCollector) Collect(ch chan<- - - } - --func (c *NSDCollector) updateMetricsList() error { -+func (c *NSDCollector) updateMetric(s string) error { -+ // Assume line is in "metric=#" format -+ line := strings.Split(s, "=") -+ metricName := strings.TrimSpace(line[0]) -+ -+ _, exists := c.metrics[metricName] -+ if !exists { -+ metricConf, ok := metricConfiguration.Metrics[metricName] -+ if ok { -+ promName := nsdToProm.Replace(line[0]) -+ c.metrics[metricName] = &promMetric{ -+ desc: prometheus.NewDesc( -+ prometheus.BuildFQName(*nsdType, "", promName), -+ metricConf.Help, -+ nil, -+ nil, -+ ), -+ valueType: metricConf.Type, -+ } -+ } else { // Try labeled metric -+ for _, v := range metricConfiguration.LabelMetrics { -+ labels := v.Regex.FindStringSubmatch(metricName) -+ if labels != nil { -+ var promName string -+ if v.Name != "" { -+ promName = v.Name -+ } else { -+ promName = nsdToProm.Replace(line[0]) -+ } -+ c.metrics[metricName] = &promMetric{ -+ desc: prometheus.NewDesc( -+ prometheus.BuildFQName(*nsdType, "", promName), -+ v.Help, -+ v.Labels, -+ nil, -+ ), -+ valueType: v.Type, -+ labels: labels[1:len(labels)], -+ } -+ // python "for-else" -+ goto Found -+ } -+ } -+ return fmt.Errorf("Metric ", metricName, " not found in config.") -+ Found: -+ } -+ } -+ return nil -+} -+ -+func (c *NSDCollector) initMetricsList() error { - r, err := c.client.Command("stats_noreset") - if err != nil { - log.Println(err) -@@ -98,49 +159,9 @@ func (c *NSDCollector) updateMetricsList - // Grab metrics - s := bufio.NewScanner(r) - for s.Scan() { -- // Assume line is in "metric=#" format -- line := strings.Split(s.Text(), "=") -- metricName := line[0] -- -- _, exists := c.metrics[metricName] -- if !exists { -- metricConf, ok := metricConfiguration.Metrics[metricName] -- if ok { -- promName := nsdToProm.Replace(line[0]) -- c.metrics[metricName] = &promMetric{ -- desc: prometheus.NewDesc( -- prometheus.BuildFQName(*nsdType, "", promName), -- metricConf.Help, -- nil, -- nil, -- ), -- valueType: metricConf.Type, -- } -- } else { // Try labeled metric -- for _, v := range metricConfiguration.LabelMetrics { -- // TODO: Move this to Collect(), to catch any metrics that are created at runtime -- // Unfortunately prom needs all metrics defined at the beginning -- labels := v.Regex.FindStringSubmatch(metricName) -- if labels != nil { -- var promName string -- if v.Name != "" { -- promName = v.Name -- } else { -- promName = nsdToProm.Replace(line[0]) -- } -- c.metrics[metricName] = &promMetric{ -- desc: prometheus.NewDesc( -- prometheus.BuildFQName(*nsdType, "", promName), -- v.Help, -- v.Labels, -- nil, -- ), -- valueType: v.Type, -- labels: labels[1:len(labels)], -- } -- } -- } -- } -+ err = c.updateMetric(s.Text()) -+ if err != nil { -+ log.Println(err.Error(), "Skipping.") - } - } - return s.Err() -@@ -156,7 +177,7 @@ func NewNSDCollector(nsdType string, hos - client: client, - } - -- err = collector.updateMetricsList() -+ err = collector.initMetricsList() - if err != nil { - log.Println(err) - return nil, err -@@ -174,7 +195,7 @@ func NewNSDCollectorFromConfig(path stri - client: client, - } - -- err = collector.updateMetricsList() -+ err = collector.initMetricsList() - if err != nil { - log.Println(err) - return nil, err
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403131639.42DGdG7f000118>