-
Notifications
You must be signed in to change notification settings - Fork 16
SEAB-7366: Change graphs in versions table to monthly time series #2150
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
SEAB-7366: Change graphs in versions table to monthly time series #2150
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2150 +/- ##
===========================================
+ Coverage 41.58% 41.92% +0.34%
===========================================
Files 394 394
Lines 12495 12521 +26
Branches 2979 2981 +2
===========================================
+ Hits 5196 5250 +54
+ Misses 4973 4945 -28
Partials 2326 2326 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/app/shared/timeseries.service.ts
Outdated
| let intervalCount = Math.max(Math.floor((to - from) / TimeConstants.AVERAGE_MONTH_MILLIS) - 2, 0); | ||
| let when = this.addIntervals(from, intervalCount); | ||
| // Step 2: Add more intervals, one by one, until we've passed the "to" time. | ||
| while (when < to) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the loop just the same as calculating the length of the internal and just dividing by your average month milliseconds?
May be more readable as
dayjs.duration().asMonths();
https://day.js.org/docs/en/durations/months
|
I made the Regarding the time computations themselves, yes, it'd be great to make the arithmetic time manipulations more readable and type-safe. For example, to change stuff like: to However, I have not found an existing library that looks robust and well-designed enough to be used confidently. We need to implement the time series adjustments precisely in UTC, without accidentally lapsing to local time or DST, otherwise time series that have been generated at different times may become misaligned with each other or mislabeled when displayed in our UI (which is bad). Such problems can also potentially be huge PITA to debug and remedy, if they only happen occasionally and are buried deep in the library somewhere. Lots of the existing libraries have mutable date representations, which are an open invitation to future bugs and should be avoided. So, I strongly recommend staying with the existing arithmetic time computations for now. To help, I've added commented and simplified the ones that might be confusing. After the new Temporal API https://tc39.es/proposal-temporal/ is finalized and released, we should consider using it (easy to do). It's very similar to the time APIs introduced in Java 8, which are very well designed, and we use to implement similar functionality in the webservice. Also, built-in libraries are also likely to be very-stringently vetted, better documented, and more functionality correct. Using the Temporal API's |
Try taking a look at https://github.com/you-dont-need/You-Dont-Need-Momentjs/blob/master/README.md#brief-comparison and the code examples, I'm not wedded to any of the three. But I do think that a lot of time has been spent by others looking at and working on them and they deserve more time/consideration. In particular
I think this is intentional to reduce library size and not meant as a comment on quality.
I don't necessarily disagree with this, and it may be worth a deeper look since it may have released this year? ( https://computus.org/when-can-i-use-temporal/ ) . The larger point is that if we further pursue the line of thought as to which alternative is better vetted and documented, that doesn't really act as an argument for our own date/time code which we know for sure has few eyes on it. |
|
Another interesting compromise/possibility https://www.npmjs.com/package/temporal-polyfill |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was here, thanks for looking into Temporal.
Circle ci tests either not passing or stuck, can't tell easily on mobile. Otherwise looking good.
|
|
I changed the "interval operations" code to use |
| "lib": [ | ||
| "es2017", | ||
| "dom" | ||
| "es2021", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includes some definitions needed by the Temporal polyfill.
Description
This PR modifies the UI's time series related code to:
DAYorMONTH(in addition to the existingWEEKsupport).adjustTimeSeriesfunctionality.To cleanly implement the support for time series with intervals of
DAYorMONTH, we refactorTimeSeriesServiceso that internally, it performs interval-specific time series operatings by delegating to an instance ofIntervalOps, which is an interface that encapsulates methods that manipulate time and generate labels for a particular time series interval. Factory methodcreateIntervalOpscreates an instance that implementsIntervalOpsand is compatible with a particular time series. Supporting an another time series interval should be as easy as creating a corresponding implementation ofIntervalOpsand adjusting the factory method to use it.Review Instructions
On qa, navigate to the "Versions" tab of a workflow with metrics, and confirm that there is a "Monthly Runs" column that displays a monthly time series for versions with metrics.
Issue
https://ucsc-cgl.atlassian.net/browse/SEAB-7366
Security
If there are any concerns that require extra attention from the security team, highlight them here.
Please make sure that you've checked the following before submitting your pull request. Thanks!
npm run buildmarkdown-wrappercomponent, which does extra sanitizationnpm auditand ensure you are not introducing new vulnerabilities