ref(sessions) Change sessions interval calculation to align with metric intervals#60466
Conversation
change interval calculation fix tests (with the exception of test_interval_restrictions)
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #60466 +/- ##
==========================================
- Coverage 80.89% 80.89% -0.01%
==========================================
Files 5185 5185
Lines 227508 227491 -17
Branches 38244 38237 -7
==========================================
- Hits 184035 184020 -15
Misses 37854 37854
+ Partials 5619 5617 -2
|
| assert response.status_code == 200, response.content | ||
| assert response.data == { | ||
| "start": "2021-03-14T12:00:00Z", | ||
| "end": "2021-03-14T12:28:00Z", |
There was a problem hiding this comment.
as mentioned in chat, the previous hack / NOTE related to snuba caching was there to have fresher data.
In this example, the end extends past the "current" (frozen) time. Because of the caching based on the end timestamp, you would only get fresh data once every 5 minutes (the cache time back when I implemented that).
With the "cache busting", effectively truncating the end to the current time, you would get a more uptodate view of the most recent "now" interval.
There was a problem hiding this comment.
Thanks for clarifying
This PR changes the interval calculation for the sessions api to align to the interval calculation of metrics api.
In short, given a
start_time,end_timeand anintervalthe calculated intervals are going to:start_timeifstart_timeis aligned withintervalor at the first time beforestart_timethat is aligned withinterval.end_timeifend_timeis aligned withintervalor at the first time afterend_timethat is aligned withinterval.resolves #59686