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

time display in live charts switches to the local time upon refresh #1835

Closed
jf opened this issue Jul 31, 2021 · 0 comments · Fixed by #1851
Closed

time display in live charts switches to the local time upon refresh #1835

jf opened this issue Jul 31, 2021 · 0 comments · Fixed by #1851
Labels

Comments

@jf
Copy link

jf commented Jul 31, 2021

Describe the bug

There is a bug in the display of the time in live graphs (that thankfully doesnt seem to appear when you go to “Download Report”), where the hour (time zone?) switches. It will show the time in the server's own timezone... and then at some point in the graph (depending on when you refreshed your browser to load the web UI), the time display will switch to the local timezone of your browser system.

Expected behavior

The time display should always be consistent. Either take the cue from the server (this is the default, and is fantastic)... or from the browser system.

Actual behavior

See "Describe the bug" section.

Here is a screenshot of the problem, showing how the hour switches from 11 (the server is GMT) to 19 (my system is GMT+8):
Screenshot 2021-07-30 at 19 14 22

Steps to reproduce

Set up a server in a different time zone from your local system. Load the web UI and start a run. Refresh your browser, and click "Charts". You will notice that the last time as shown in the charts will always be in your local timezone, and as more points get added to the graphs, all of those will be in your local time.

This behaviour is repeatable. Refresh your browser again, click on "Charts" again... and you will see again that all of the time values will reset to the server's time zone save for the last one.

Environment

  • OS: Ubuntu 20.04
  • Python version: 3.8.10
  • Locust version: 1.6.0
@jf jf added the bug label Jul 31, 2021
obradovichv added a commit to obradovichv/locust that referenced this issue Aug 16, 2021
Locust uses server time to store the time of a task in stats history.
When fetching the initial stats history for the client (such on on page
refresh) it is written by the server using using this stored time.
While rendering a chart on the client, locust uses the localized client
time for the time the stats history was fetched. This would lead to a
jump in the x-axis time series when server and client time zones
differed.

Stats history (stats.py) now derives time from the time component of
the current datetime in UTC instead of server time zone.
This aligns it with other time stores used throughout locust
- particularly the start_time and end_time of reports - that make use
of time.time(), which is in UTC.

The client UI report (report.html) now localizes the server-rendered
times from history (formerly in server TZ, now in UTC).
This aligns it with the client-side report timekeeping of locust.js
updateStats() used for the x-axis of charts.

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

Successfully merging a pull request may close this issue.

1 participant