Skip to content

Commit

Permalink
Merge pull request prometheus-community#1108 from breed808/os_paging
Browse files Browse the repository at this point in the history
fix: Continue os collection on missing page file
  • Loading branch information
breed808 authored Dec 17, 2022
2 parents 1f9d294 + 2908636 commit 25c1449
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions collector/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,12 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
for _, pagingFile := range pagingFiles {
fileString := strings.ReplaceAll(pagingFile, `\??\`, "")
file, err := os.Stat(fileString)
// For unknown reasons, Windows doesn't always create a page file. Continue collection rather than aborting.
if err != nil {
return nil, err
log.Debugf("Failed to read page file (reason: %s): %s\n", err, fileString)
} else {
fsipf += float64(file.Size())
}
fsipf += float64(file.Size())
}

gpi, err := psapi.GetPerformanceInfo()
Expand Down

0 comments on commit 25c1449

Please sign in to comment.