From 8b6d837483d94ccbcf1e1e46adef8b96c1ea3b21 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 18 Mar 2025 09:39:51 +0100 Subject: [PATCH] feat(ursv): add os/arch/distribution metric --- cmd/infra/ursrv/serve/serve.go | 4 ++++ lib/ur/contract/contract.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/cmd/infra/ursrv/serve/serve.go b/cmd/infra/ursrv/serve/serve.go index b1cdabc99..4e8cfe46a 100644 --- a/cmd/infra/ursrv/serve/serve.go +++ b/cmd/infra/ursrv/serve/serve.go @@ -77,6 +77,7 @@ var ( {regexp.MustCompile(`\ssyncthing@archlinux`), "Arch (3rd party)"}, {regexp.MustCompile(`@debian`), "Debian (3rd party)"}, {regexp.MustCompile(`@fedora`), "Fedora (3rd party)"}, + {regexp.MustCompile(`@openSUSE`), "openSUSE (3rd party)"}, {regexp.MustCompile(`\sbrew@`), "Homebrew (3rd party)"}, {regexp.MustCompile(`\sroot@buildkitsandbox`), "LinuxServer.io (3rd party)"}, {regexp.MustCompile(`\sports@freebsd`), "FreeBSD (3rd party)"}, @@ -351,6 +352,9 @@ func (s *server) addReport(rep *contract.Report) bool { break } } + rep.DistDist = rep.Distribution + rep.DistOS = rep.OS + rep.DistArch = rep.Arch _, loaded := s.reports.LoadAndStore(rep.UniqueID, rep) return loaded diff --git a/lib/ur/contract/contract.go b/lib/ur/contract/contract.go index bc51c560c..e78dc4112 100644 --- a/lib/ur/contract/contract.go +++ b/lib/ur/contract/contract.go @@ -190,6 +190,11 @@ type Report struct { Country string `json:"country" metric:"location,gaugeVec:country"` CountryCode string `json:"countryCode" metric:"location,gaugeVec:countryCode"` MajorVersion string `json:"majorVersion" metric:"reports_by_major_total,gaugeVec:version"` + + // Once more to create a metric on OS, arch, distribution + DistDist string `json:"distDist" metric:"distribution,gaugeVec:distribution"` + DistOS string `json:"distOS" metric:"distribution,gaugeVec:os"` + DistArch string `json:"distArch" metric:"distribution,gaugeVec:arch"` } func New() *Report {