Add `system.paging.faults` metrics on Windows
Description
Added the system.paging.faults metrics on Windows.
Testing
Besides updated tests the change was validated with a local run of the collector and the new metric.
Documentation
N/A since this metric was not documented as not being generated on Windows.
CI has failures in two scrappers of the hostmetricsreceive, one is the scrapper being changed in this PR and the other is on the loadscraper. I will look at it later today, detailed info:
https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/15427440377/job/43417762772?pr=40468#step:8:165
=== FAIL: internal/scraper/loadscraper TestScrape (3.01s)
make[2]: *** [../../Makefile.Common:105: test] Error 1
==================
WARNING: DATA RACE
Read at 0x000140cc82e8 by goroutine 16:
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.(*sampler).startSamplingTicker.func1()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper_windows.go:102 +0x3e
Previous write at 0x000140cc82e8 by goroutine 17:
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.setSamplingFrequency()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper_windows.go:57 +0x4b1
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.TestScrape()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper_test.go:142 +0x4a5
testing.tRunner()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:1690 +0x1dd
testing.(*T).Run.gowrap1()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:1743 +0x44
Goroutine 16 (running) created at:
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.(*sampler).startSamplingTicker()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper_windows.go:101 +0x8d
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.startSampling()
make[1]: *** [Makefile:254: receiver/hostmetricsreceiver] Error 2
make[1]: *** Waiting for unfinished jobs....
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper_windows.go:81 +0x358
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.(*loadScraper).start()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/load_scraper.go:55 +0x32b
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.(*loadScraper).start-fm()
<autogenerated>:1 +0x64
go.opentelemetry.io/collector/component.StartFunc.Start()
C:/Users/runneradmin/go/pkg/mod/go.opentelemetry.io/collector/[email protected]/component.go:66 +0x7c
go.opentelemetry.io/collector/scraper.(*metrics).Start()
<autogenerated>:1 +0x38
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.TestComponentLifecycle.func3()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/generated_component_test.go:66 +0x3cd
testing.tRunner()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:1690 +0x1dd
testing.(*T).Run.gowrap1()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:1743 +0x44
Goroutine 17 (running) created at:
testing.(*T).Run()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:1743 +0x83c
testing.runTests.func1()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:2168 +0x85
testing.tRunner()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:1690 +0x1dd
testing.runTests()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:2[166](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/15427440377/job/43417762772?pr=40468#step:8:167) +0x8be
testing.(*M).Run()
C:/hostedtoolcache/windows/go/1.23.9/x64/src/testing/testing.go:2034 +0xf17
go.uber.org/goleak.VerifyTestMain()
C:/Users/runneradmin/go/pkg/mod/go.uber.org/[email protected]/testmain.go:53 +0x64
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper.TestMain()
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/loadscraper/generated_package_test.go:12 +0x184
main.main()
_testmain.go:65 +0x16d
==================
testing.go:1399: race detected during execution of test
=== FAIL: internal/scraper/pagingscraper TestScrape/Standard (0.00s)
testutils.go:72:
Error Trace: C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/testutils.go:72
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go:91
Error: Not equal:
expected: 0x1845a37bc33651b0
actual : 0x1845a37bc3[176](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/15427440377/job/43417762772?pr=40468#step:8:177)28c
Test: TestScrape/Standard
Messages: metrics contained different end timestamp values
=== FAIL: internal/scraper/pagingscraper TestScrape/Standard_with_direction_removed (0.00s)
testutils.go:72:
Error Trace: C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/testutils.go:72
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go:91
Error: Not equal:
expected: 0x1845a37bc3cb9ba8
actual : 0x[184](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/15427440377/job/43417762772?pr=40468#step:8:185)5a37bc3c6b110
Test: TestScrape/Standard_with_direction_removed
Messages: metrics contained different end timestamp values
=== FAIL: internal/scraper/pagingscraper TestScrape (0.01s)
=== FAIL: internal/scraper/pagingscraper TestScrape/Standard_with_direction_removed (re-run 1) (0.49s)
testutils.go:72:
Error Trace: C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/testutils.go:72
C:/a/opentelemetry-collector-contrib/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_test.go:91
Error: Not equal:
expected: 0x1845a3827403eaec
actual : 0x1845a38273f0214c
Test: TestScrape/Standard_with_direction_removed
Messages: metrics contained different end timestamp values
=== FAIL: internal/scraper/pagingscraper TestScrape (re-run 1) (0.49s)
DONE 2 runs, 351 tests, 3 skipped, 6 failures in 46.749s
@pjanotti PTAL at the failing tests
@dmitryax ops, I guess a ran the local tests on the wrong terminal 🤦🏼♂️ ... anyway, the only way to get the correct number of failures is either to have the page faults scraping on the same scope as the original scrapererror.ScrapeErrors or to pass it as referece to the function called from the scope where the local scrapererror.ScrapeErrors is created. I opted for the latter.