sharlatan pushed a commit to branch go-team
in repository guix.

commit 9c464abd6e43635cafe70f198cb8018add770566
Author: Sharlatan Hellseher <[email protected]>
AuthorDate: Sun Dec 29 00:04:04 2024 +0000

    gnu: go-github-com-prometheus-node-exporter: 1.8.2-0.b8aac7c.
    
    * gnu/packages/monitoring.scm: Add golang-build, golang-web, golang-xyz,
    and prometheus modules.
    (go-github-com-prometheus-node-exporter): 1.8.2-0.b8aac7c.
    [arguments] <install-source?>: Skip source installation as it's a final
    command.
    <build-flags>: Provide ldflags.
    <embed-files>: Copy 2 files required as not symlinks.
    <phases>: Add 'pre-check and 'post-check - unpacking and removing
    provided test data.
    [propagated-inputs]: Add go-github-com-alecthomas-kingpin-v2,
    go-github-com-beevik-ntp, go-github-com-coreos-go-systemd-v22,
    go-github-com-dennwc-btrfs, go-github-com-ema-qdisc,
    go-github-com-go-kit-log, go-github-com-godbus-dbus-v5,
    go-github-com-hashicorp-go-envparse, go-github-com-hodgesds-perf-utils,
    go-github-com-josharian-native, go-github-com-jsimonetti-rtnetlink,
    go-github-com-mattn-go-xmlrpc, go-github-com-mdlayher-ethtool,
    go-github-com-mdlayher-netlink, go-github-com-mdlayher-wifi,
    go-github-com-jsimonetti-rtnetlink-v2,
    go-github-com-opencontainers-selinux,
    go-github-com-prometheus-client-golang,
    go-github-com-prometheus-client-model, go-github-com-prometheus-common,
    go-github-com-prometheus-community-go-runit,
    go-github-com-prometheus-exporter-toolkit,
    go-github-com-prometheus-procfs-next, go-github-com-safchain-ethtool,
    go-golang-org-x-exp, go-golang-org-x-sys, and go-howett-net-plist.
    
    * gnu/packages/prometheus.scm (go-github-com-prometheus-procfs-next):
    New variable.
    
    Change-Id: I06f9d5d99266ca1abb3e8203ec66d9415842306a
---
 gnu/packages/monitoring.scm | 103 ++++++++++++++++++++++++++++++++++++--------
 gnu/packages/prometheus.scm |  20 +++++++++
 2 files changed, 104 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/monitoring.scm b/gnu/packages/monitoring.scm
index 7dd30f9a6e..2198eb9d53 100644
--- a/gnu/packages/monitoring.scm
+++ b/gnu/packages/monitoring.scm
@@ -54,6 +54,9 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gnome)               ;libnotify
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages golang-build)
+  #:use-module (gnu packages golang-web)
+  #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages image)
   #:use-module (gnu packages mail)
   #:use-module (gnu packages ncurses)
@@ -62,6 +65,7 @@
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages prometheus)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-web)
@@ -522,26 +526,87 @@ WSGI and the node exporter textfile collector.")
     (license license:asl2.0)))
 
 (define-public go-github-com-prometheus-node-exporter
-  (package
-    (name "go-github-com-prometheus-node-exporter")
-    (version "0.18.1")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/prometheus/node_exporter";)
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0s3sp1gj86p7npxl38hkgs6ymd3wjjmc5hydyg1b5wh0x3yvpx07"))))
-    (build-system go-build-system)
-    (arguments
-     '(#:import-path "github.com/prometheus/node_exporter"))
-    (synopsis "Prometheus exporter for hardware and OS metrics")
-    (description "Prometheus exporter for metrics exposed by *NIX kernels,
+  ;; The latest release is failing to build, use the latest commit from the
+  ;; master branch.
+  (let ((commit "b8aac7c92e2d7f3dea56b2d4802d4ef3ee29c3cc")
+        (revision "0"))
+    (package
+      (name "go-github-com-prometheus-node-exporter")
+      (version (git-version "1.8.2" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/prometheus/node_exporter";)
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0n2s2z168xzp6i0ihaqvvs8zinp1iqld45c6lj89x7wjv8m741j3"))))
+      (build-system go-build-system)
+      (arguments
+       (list
+        #:install-source? #f
+        #:build-flags
+        #~(list (string-append
+                 "-ldflags="
+                 "-X github.com/prometheus/common/version.Version=" #$version
+                 " -X github.com/prometheus/common/version.Revision=" 
#$revision
+                 " -X github.com/prometheus/common/version.Branch=master"
+                 " -X github.com/prometheus/common/version.BuildUser=guix"
+                 " -X github.com/prometheus/common/version.BuildDate=n/a"))
+        #:embed-files #~(list "landing_page.css" "landing_page.html")
+        #:import-path "github.com/prometheus/node_exporter"
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'check 'pre-check
+              (lambda* (#:key tests? import-path #:allow-other-keys)
+                (with-directory-excursion (string-append "src/" import-path)
+                  (invoke "./ttar" "-C" "collector/fixtures"
+                          "-x" "-f" "collector/fixtures/sys.ttar")
+                  (invoke "./ttar" "-C" "collector/fixtures"
+                          "-x" "-f" "collector/fixtures/udev.ttar"))))
+            (add-after 'check 'post-check
+              (lambda* (#:key tests? import-path #:allow-other-keys)
+                (with-directory-excursion (string-append "src/" import-path)
+                  (for-each delete-file-recursively
+                            (list "collector/fixtures/sys"
+                                  "collector/fixtures/sys.ttar"
+                                  "collector/fixtures/udev"
+                                  "collector/fixtures/udev.ttar"))))))))
+      (propagated-inputs
+       (list go-github-com-alecthomas-kingpin-v2
+             go-github-com-beevik-ntp
+             go-github-com-coreos-go-systemd-v22
+             go-github-com-dennwc-btrfs
+             go-github-com-ema-qdisc
+             go-github-com-go-kit-log
+             go-github-com-godbus-dbus-v5
+             go-github-com-hashicorp-go-envparse
+             go-github-com-hodgesds-perf-utils
+             go-github-com-josharian-native
+             go-github-com-jsimonetti-rtnetlink
+             go-github-com-mattn-go-xmlrpc
+             go-github-com-mdlayher-ethtool
+             go-github-com-mdlayher-netlink
+             go-github-com-mdlayher-wifi
+             go-github-com-jsimonetti-rtnetlink-v2
+             go-github-com-opencontainers-selinux
+             go-github-com-prometheus-client-golang
+             go-github-com-prometheus-client-model
+             go-github-com-prometheus-common
+             go-github-com-prometheus-community-go-runit
+             go-github-com-prometheus-exporter-toolkit
+             go-github-com-prometheus-procfs-next
+             go-github-com-safchain-ethtool
+             go-golang-org-x-exp
+             go-golang-org-x-sys
+             go-howett-net-plist))
+      (home-page "https://github.com/prometheus/node_exporter";)
+      (synopsis "Prometheus exporter for hardware and OS metrics")
+      (description
+       "Prometheus exporter for metrics exposed by *NIX kernels,
 written in Go with pluggable metric collectors.")
-    (home-page "https://github.com/prometheus/node_exporter";)
-    (license license:asl2.0)))
+      (license license:asl2.0))))
 
 (define-public temper-exporter
   (let ((commit "a87bbab19c05609d62d9e4c7941178700c1ef84d")
diff --git a/gnu/packages/prometheus.scm b/gnu/packages/prometheus.scm
index 1adb42bb9a..e582673a0d 100644
--- a/gnu/packages/prometheus.scm
+++ b/gnu/packages/prometheus.scm
@@ -508,6 +508,26 @@ Protocol,ICMP} echo (ping) functionality.")
 kernel, and process metrics from the @file{/proc} pseudo file system.")
     (license license:asl2.0)))
 
+;; To make it compatible with node_exporter, see
+;; <https://github.com/prometheus/node_exporter/issues/3143>.
+(define-public go-github-com-prometheus-procfs-next
+  (let ((commit "24ab3d8d880d820115eef19f7b0c2c38fffd6a25")
+        (revision "0"))
+    (hidden-package
+     (package
+       (inherit go-github-com-prometheus-procfs)
+       (name "go-github-com-prometheus-procfs")
+       (version (git-version "0.15.2" revision commit))
+       (source
+        (origin
+          (method git-fetch)
+          (uri (git-reference
+                (url "https://github.com/prometheus/procfs";)
+                (commit commit)))
+          (file-name (git-file-name name version))
+          (sha256
+           (base32 
"0fv3f83q5wigbpl6mdpk4k7bj8jabc81rap0ym95l7rpw93cdlim"))))))))
+
 (define-public go-github-com-prometheus-statsd-exporter
   (package
     (name "go-github-com-prometheus-statsd-exporter")

Reply via email to