Skip to content

Commit

Permalink
Merge pull request #1317 from DiniFarb/os_rev_num
Browse files Browse the repository at this point in the history
feat(#1300): add revision to windows_os_info
  • Loading branch information
breed808 authored Nov 12, 2023
2 parents d3c54d4 + a08474b commit 569f545
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion collector/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func newOSCollector(logger log.Logger) (Collector, error) {
OSInformation: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "info"),
"OperatingSystem.Caption, OperatingSystem.Version",
[]string{"product", "version", "major_version", "minor_version", "build_number"},
[]string{"product", "version", "major_version", "minor_version", "build_number", "revision"},
nil,
),
PagingLimitBytes: prometheus.NewDesc(
Expand Down Expand Up @@ -199,6 +199,11 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
return nil, err
}

revision, _, err := ntKey.GetIntegerValue("UBR")
if err != nil {
return nil, err
}

var fsipf float64
for _, pagingFile := range pagingFiles {
fileString := strings.ReplaceAll(pagingFile, `\??\`, "")
Expand Down Expand Up @@ -242,6 +247,7 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
fmt.Sprintf("%d", nwgi.VersionMajor), // Major Version
fmt.Sprintf("%d", nwgi.VersionMinor), // Minor Version
bn, // Build number
fmt.Sprintf("%d", revision), // Revision
)

ch <- prometheus.MustNewConstMetric(
Expand Down

0 comments on commit 569f545

Please sign in to comment.