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

NAS-132019 / 25.04 / Remove DST gaps from chart reports #11086

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bvasilenko
Copy link
Contributor

Changes:

Screenshot attached to a ticket depicts the DST gap, which occurs when server's internal clock does a transition from time point 1:59 to time point 3:00 GMT+0100, and timezone info (GMT+0100) is lost, resulting in representational 1:01 hour gap

In pseudocode:

Actual:

> new Date(`Jan 01 2024 01:59:00`) - new Date(`Jan 01 2024 03:00:00`)
  -> -3660000

Expected:

> new Date(`Jan 01 2024 01:59:00 GMT+0000`) - new Date(`Jan 01 2024 03:00:00 GMT+0100`) 
  -> -60000

This PR removes DST gaps from reporting time series.

Testing:

To simulate DST, you need to add the addDstGaps method in the src/app/pages/reports-dashboard/reports.service.ts file and apply it to reportingData.data as shown below:

image

Replace the constant dstTimestamp with the value of the DST change time (in seconds!).

For example, 1732168676 <=> Thu Nov 21 2024 08:57:56 GMT+0300.

A gap of one hour should appear on the chart:

image

Using the removeDstGaps method should remove this gap.

addDstGaps method code:

addDstGaps(data: number[][]): number[][] {
    data.forEach((item) => {
      const dstTimestamp = new Date().getTime() / 1000 - 10 * 60; // Set DST time, e.g. 1732168676
      if (item[0] > dstTimestamp) {
        item[0] = item[0] + 3600;
      }
    });
    return data;
}

@bvasilenko bvasilenko requested a review from a team as a code owner November 22, 2024 06:48
@bvasilenko bvasilenko requested review from undsoft and removed request for a team November 22, 2024 06:48
@bugclerk
Copy link
Contributor

@bugclerk bugclerk changed the title Remove DST gaps from chart reports NAS-132019 / 25.04 / Remove DST gaps from chart reports Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.37%. Comparing base (807b9d8) to head (f620f67).
Report is 11 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11086      +/-   ##
==========================================
+ Coverage   82.30%   82.37%   +0.06%     
==========================================
  Files        1631     1632       +1     
  Lines       57286    57325      +39     
  Branches     5917     5915       -2     
==========================================
+ Hits        47152    47220      +68     
+ Misses      10134    10105      -29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@undsoft
Copy link
Collaborator

undsoft commented Nov 22, 2024

So if I understand the PR correctly, middleware returns timestamps that may jump from some value to another hour. If this is the case, then this is not a UI issue as timestamps don't care about DST.

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

Successfully merging this pull request may close these issues.

3 participants