feat(ursv): add os/arch/distribution metric

This commit is contained in:
Jakob Borg
2025-04-13 09:40:14 +02:00
parent 3e74b3dee2
commit 8b6d837483
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -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
+5
View File
@@ -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 {