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

node_time_zone_offset_seconds doesn't reflect timezone change #2273

Closed
datuxing opened this issue Jan 27, 2022 · 4 comments
Closed

node_time_zone_offset_seconds doesn't reflect timezone change #2273

datuxing opened this issue Jan 27, 2022 · 4 comments

Comments

@datuxing
Copy link

Host operating system: output of uname -a

Linux 3.10.0-1160.36.2.el7.x86_64

node_exporter version: output of node_exporter --version

version 1.3.1

node_exporter command line flags

N/A

Are you running node_exporter in Docker?

No

What did you do that produced an error?

changed system timezone, but node_time_zone_offset_seconds still showing previous timezone.
after restart node_exporter service, it can collect correct timezone info.

What did you expect to see?

expect to get timezone change using node_time_zone_offset_seconds as soon as possible.

What did you see instead?

node_time_zone_offset_seconds still showing previous timezone.

@discordianfish
Copy link
Member

@datuxing
Copy link
Author

Hrmm this is unexpected.. we read the zoneinfo data on every scrape:

I saw node_time_zone_offset_seconds is collect by https://github.com/prometheus/node_exporter/blob/master/collector/time.go#L71

I have run a simple golang code continue to print time.Now().Zone() in a loop, and it always print pervious timezone after changed system timezone. maybe golang runtime can't detect timezone change?

@datuxing
Copy link
Author

Hrmm this is unexpected.. we read the zoneinfo data on every scrape:

I saw node_time_zone_offset_seconds is collect by https://github.com/prometheus/node_exporter/blob/master/collector/time.go#L71

I have run a simple golang code continue to print time.Now().Zone() in a loop, and it always print pervious timezone after changed system timezone. maybe golang runtime can't detect timezone change?

seems it's known issue of golang, golang/go#28020
so node_time_zone_offset_seconds can't reflect timezone change if it collect by using golang time.Now().Zone()

@SuperQ
Copy link
Member

SuperQ commented Jan 28, 2022

We might want to add a note to the README to mention that changes require a restart of the exporter.

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

No branches or pull requests

3 participants