Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic in time collector on Windows Server 2016 (no ppb counter) #1891

Open
brajjan opened this issue Feb 19, 2025 · 2 comments · May be fixed by #1910
Open

panic in time collector on Windows Server 2016 (no ppb counter) #1891

brajjan opened this issue Feb 19, 2025 · 2 comments · May be fixed by #1910
Labels

Comments

@brajjan
Copy link

brajjan commented Feb 19, 2025

Current Behavior

Running version 30.4 on Windows Server 2016 results in panic in collector time. Seems like the performance counters for Windows Time Service does not contain the \Windows Time Service\Clock Frequency Adjustment (PPB) counter.

PS C:\> (get-counter -ListSet "Windows Time Service").counter
\Windows Time Service\NTP Server Outgoing Responses
\Windows Time Service\NTP Server Incoming Requests
\Windows Time Service\NTP Client Time Source Count
\Windows Time Service\NTP Roundtrip Delay
\Windows Time Service\Clock Frequency Adjustment
\Windows Time Service\Computed Time Offset
source=collect.go:212 msg="collector time failed after 2.9995ms, resulting in 0 metrics" err="panic in collector time: runtime error: invalid memory address or nil pointer dereference. stack: goroutine 2742 [running]:\nruntime/debug.Stack()\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/debug/stack.go:26 +0x5e\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1.1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:128 +0x65\npanic({0x13d0340?, 0x1b37f30?})\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/panic.go:785 +0x132\ngithub.com/prometheus/client_golang/prometheus.NewConstMetric(0x0?, 0xbcd514?, 0xd453ed?, {0x0?, 0xc0006eb990?, 0xd42944?})\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:106 +0x17\ngithub.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:127\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).collectTime(0xc0000b6180, 0xc000848c40)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:208 +0x8a\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).Collect(0xc0000b6180, 0xc000848c40)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:193 +0xe5\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:135 +0x82\ncreated by github.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector in goroutine 2726\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:124 +0x1aa\n"

Tested on 2016, 2019, 2022 & 2025 and only errors on 2016

Expected Behavior

no panic

Steps To Reproduce

make sure the time collector is enabled, start windows_exporter and check logs

Environment

  • windows_exporter Version: 0.30.4
  • Windows Server Version: 2016

windows_exporter logs

source=collect.go:212 msg="collector time failed after 2.9995ms, resulting in 0 metrics" err="panic in collector time: runtime error: invalid memory address or nil pointer dereference. stack: goroutine 2742 [running]:\nruntime/debug.Stack()\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/debug/stack.go:26 +0x5e\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1.1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:128 +0x65\npanic({0x13d0340?, 0x1b37f30?})\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/panic.go:785 +0x132\ngithub.com/prometheus/client_golang/prometheus.NewConstMetric(0x0?, 0xbcd514?, 0xd453ed?, {0x0?, 0xc0006eb990?, 0xd42944?})\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:106 +0x17\ngithub.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:127\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).collectTime(0xc0000b6180, 0xc000848c40)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:208 +0x8a\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).Collect(0xc0000b6180, 0xc000848c40)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:193 +0xe5\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:135 +0x82\ncreated by github.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector in goroutine 2726\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:124 +0x1aa\n"

Anything else?

No response

@brajjan
Copy link
Author

brajjan commented Feb 19, 2025

This is the counters from a > 2016-machine

PS C:\> (get-counter -ListSet "Windows Time Service").counter
\Windows Time Service\NTP Server Outgoing Responses
\Windows Time Service\NTP Server Incoming Requests
\Windows Time Service\NTP Client Time Source Count
\Windows Time Service\NTP Roundtrip Delay
\Windows Time Service\Clock Frequency Adjustment (PPB)
\Windows Time Service\Clock Frequency Adjustment
\Windows Time Service\Computed Time Offset

Descriptions below

2016 - Clock Frequency Adjustment
The absolute clock frequency adjustment made to the local system clock by W32Time in parts per billion. This counter helps visualize the actions being taken by W32time.

2025 - Clock Frequency Adjustment
This value reflects the adjustment made to the local system clock frequency by W32Time in nominal clock units. This counter helps visualize the finer adjustments being made by W32time to synchronize the local clock.

2025 - Clock Frequency Adjustment (PPB)
This value reflects the adjustment made to the local system clock frequency by W32Time in Parts Per Billion (PPB) units. 1 PPB adjustment imples the system clock was adjusted at a rate of 1 nanosecond per second. The smallest possible adjustment can vary and can be expected to be in the order of 100's of PPB. This counter helps visualize the finer actions being taken by W32time to synchronize the local clock.

@kago-dk
Copy link

kago-dk commented Feb 22, 2025

Likely same issue I run into
source=collect.go:212 msg="collector time failed after 0s, resulting in 0 metrics" err="panic in collector time: runtime error: invalid memory address or nil pointer dereference. stack: goroutine 25319 [running]:\nruntime/debug.Stack()\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/debug/stack.go:26 +0x5e\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1.1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:128 +0x65\npanic({0x11b0340?, 0x1917f30?})\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/panic.go:785 +0x132\ngithub.com/prometheus/client_golang/prometheus.NewConstMetric(0xc0009b19b8?, 0x987785?, 0xc0009b19f8?, {0x0?, 0x98bb76?, 0x49601993900?})\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:106 +0x17\ngithub.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:127\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).collectTime(0xc0002d4500, 0xc0006a2000)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:208 +0x8a\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).Collect(0xc0002d4500, 0xc0006a2000)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:193 +0xe5\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:135 +0x82\ncreated by github.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector in goroutine 25311\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:124 +0x1aa\n"

source=collect.go:212 msg="collector time failed after 0s, resulting in 0 metrics" err="panic in collector time: runtime error: invalid memory address or nil pointer dereference. stack: goroutine 25319 [running]:\nruntime/debug.Stack()\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/debug/stack.go:26 +0x5e\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1.1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:128 +0x65\npanic({0x11b0340?, 0x1917f30?})\n\tC:/hostedtoolcache/windows/go/1.23.6/x64/src/runtime/panic.go:785 +0x132\ngithub.com/prometheus/client_golang/prometheus.NewConstMetric(0xc0009b19b8?, 0x987785?, 0xc0009b19f8?, {0x0?, 0x98bb76?, 0x49601993900?})\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:106 +0x17\ngithub.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)\n\tC:/Users/runneradmin/go/pkg/mod/github.com/prometheus/client_golang@v1.21.0-rc.0/prometheus/value.go:127\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).collectTime(0xc0002d4500, 0xc0006a2000)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:208 +0x8a\ngithub.com/prometheus-community/windows_exporter/internal/collector/time.(*Collector).Collect(0xc0002d4500, 0xc0006a2000)\n\tD:/a/windows_exporter/windows_exporter/internal/collector/time/time.go:193 +0xe5\ngithub.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector.func1()\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:135 +0x82\ncreated by github.com/prometheus-community/windows_exporter/pkg/collector.(*Collection).collectCollector in goroutine 25311\n\tD:/a/windows_exporter/windows_exporter/pkg/collector/collect.go:124 +0x1aa\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants