Repository navigation
Support for multiple reroute metric collection - #348
Conversation
| mapboxNavigation.setSessionState(mapboxNavigation.getSessionState().toBuilder() | ||
| .routeProgressBeforeReroute(routeProgress) | ||
| .beforeRerouteLocations(Arrays.asList( | ||
| locationBuffer.toArray(new Location[locationBuffer.size()]))) |
There was a problem hiding this comment.
Won't this set ~40 beforeRerouteLocations?
There was a problem hiding this comment.
No, Originally, I set this up similar to how iOS was handling this but I found that filtering based on time would be less efficient than simply storing an array of before and after location updates like we were previously doing. Essentially, when a reroute event occurs we capture a "snapshot" of the session state and hold onto it for ~20 seconds, add the after reroute locations and then push the event.
| } | ||
|
|
||
| void sendRerouteEvent(SessionState sessionState) { | ||
| mapboxNavigation.setSessionState(sessionState.toBuilder() |
There was a problem hiding this comment.
By capturing the session state at the time of reroute, how do we capture and send up the new geometry, etc associated resulting from the reroute?
There was a problem hiding this comment.
iOS updates this info here after the reroute request comes back:
fcc0099 to
0a0dd10
Compare
|
All looks good and correct to me, going ahead and merging. |
| return new Location[0]; | ||
| } | ||
| // Reverse the list order to conform with the spec | ||
| Collections.reverse(locations); |
There was a problem hiding this comment.
Is this still necessary since locations are added with addLast() instead of push()?
| .beforeRerouteLocations(Arrays.asList( | ||
| locationBuffer.toArray(new Location[locationBuffer.size()]))) | ||
| .routeProgressBeforeReroute(routeProgress) | ||
| .lastRerouteDate(new Date()) |
There was a problem hiding this comment.
Won't this cause SessionState.timeFromLastReroute() to take the diff from the current reroute date rather than the previous reroute date?
| return -1; | ||
| } | ||
| long diffInMs = lastRerouteDate().getTime() - new Date().getTime(); | ||
| long diffInMs = new Date().getTime() - lastRerouteDate().getTime(); |
There was a problem hiding this comment.
SessionState.secondsSinceLastReroute() is called during Telemetry.pushEvent() which happens ~20s after the original reroute event. Since we're using new Date() here, that means secondsSinceLastReroute is computed as the seconds from the send event to the lastRerouteDate, rather than the seconds from the original reroute time to the last reroute date.
See also my comment above (https://github.com/mapbox/mapbox-navigation-android/pull/348/files#r145172948) about storing the last reroute date.
* Do not allow rotation for Nav UI (#377) * Support for multiple reroute metric collection (#348) * capture sessionState and add to queue when reroute occurs * Resolved several issues which related to location * fix checkstyle for NavigationMetricsWrapper * enable extra logging in debug mode * add option to log telemetry requests when debug mode is enabled * seconds no null anymore * make SessionState fields unique * add test for ringbuffer peak methods * create a copy of the location object when snapping a location * make sure the buffer keeps adding fresh values * Avoids out of bounds exception in addTrafficToSource() (#384) * avoids out of bounds exception * added index out of bounds exception * Undo throwing exception * force git to push * Updated changelog and readme * More reroute fixes (#389) * removed collection reverse * fix lastrerouteseconds * set the queued reroute events to represent new values * checkstyle * fixed total distance completed not getting set * make sure that the reroute event includes the reroute time as the created timestamp (#398) * temporarily change circle ci publish branch * [android] [auto] Update properties to version 0.6.3 in preparation for build. * change circleci script back to using master
Closes #336
Adds a queue and uses main thread to check the timing of when to send the event.