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

Use UTC time for server stats history, localize times on the client #1851

Merged
merged 3 commits into from
Aug 17, 2021

Commits on Aug 16, 2021

  1. fix(l10n): use UTC time on server and localize time on client

    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
    obradovichv committed Aug 16, 2021
    Configuration menu
    Copy the full SHA
    1a41541 View commit details
    Browse the repository at this point in the history
  2. fix(l10n): localize report start and end datetimes

    The "during" start and end datetimes of "Download Report" (/stats/report)
    were using server-rendered times, i.e.: strftime("%Y-%m-%d %H:%M:%S").
    When server and client time zones differed, the times of the report
    would not match the client time zone.
    These datetimes are now localized similarly to the rest of the report.
    obradovichv committed Aug 16, 2021
    Configuration menu
    Copy the full SHA
    c1d7c3c View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2021

  1. refactor(l10n): parse datetime with built-in function

    Simplify date parsing. The date value is converted to ISO8601-like
    format in UTC (Z) and parsed using built-in Date.parse().
    obradovichv committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    dccf5d4 View commit details
    Browse the repository at this point in the history