-
Notifications
You must be signed in to change notification settings - Fork 321
Don't send events if telemetry is disabled #6512
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
Don't send events if telemetry is disabled #6512
Conversation
|
@RingerJK , @LukasPaczos , do you guys think that we need to reconsider approach with telemetry initialisation/destruction as we now know that customers can disable telemetry in runtime using this Line 9 in a2bf593
|
|
@VysotskiVadim we should also refactor |
|
we should refactor EventsServiceObserver that it's not log if EventsService is disabled as well |
Codecov Report
@@ Coverage Diff @@
## main #6512 +/- ##
============================================
- Coverage 70.33% 70.31% -0.03%
Complexity 4909 4909
============================================
Files 717 718 +1
Lines 27951 27959 +8
Branches 3295 3297 +2
============================================
Hits 19660 19660
- Misses 7013 7021 +8
Partials 1278 1278
|
43e4cb3 to
260094d
Compare
fixed changelog updated changelog
e27c12a to
2d31b2a
Compare
libnavigation-metrics/src/main/java/com/mapbox/navigation/metrics/MapboxMetricsReporter.kt
Outdated
Show resolved
Hide resolved
| "MapboxMetricsReporter.init from MapboxNavigation main", | ||
| MapboxNavigationTelemetry.LOG_CATEGORY | ||
| ) | ||
| MapboxMetricsReporter.init( |
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.
I didn't see the corresponding addition of flag check in MapboxMetricsReporter. Is this intentional?
Same for toggleLogging and disable.
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.
sorry, didn't get this one
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.
I think that's okay in this context. We shouldn't if-check on init because someone could flip the global setting back at any point in time. And the TelemetryUtils.setEventsCollectionState also disables the telemetry service under the hood so we don't need to check for that.
| obtainUserAgent() | ||
| ) | ||
| MapboxMetricsReporter.toggleLogging(navigationOptions.isDebugLoggingEnabled) | ||
| MapboxNavigationTelemetry.initialize( |
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.
All the processing in MapboxNavigationTelemetry would now be running even if telemetry collection is disabled. Could we improve that control to avoid the unnecessary processing?
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.
that's a fair point. I see following options:
1. Keep as is
pros:
- telemetry events are sent whenever the SDK client turns off and on telemetry globally
- simple code
cons:
MapboxNavigationTelemetryworks but events aren't sent when telemetry is disabled
2. Initiaize MapboxNavigationTelemetry only when telemetry is turned on, always disable on destroy
pros:
MapboxNavigationTelemetrydoesn't work when telemetry is disabled globally- simple code
cons:
- telemetry events won't be sent if telemetry was turned off globally during initialization and then turned on in runtime
3. keep current telemetry state (enabled/disabled) on the sdk side, observe it and start/stop MapboxNavigationTelemetry
pros:
- telemetry events are sent whenever the SDK client turns off and on telemetry globally
MapboxNavigationTelemetrydoesn't work when telemetry is disabled globally
cons:
- complex code
I proffer the option 1
It doesn't seem that MapboxNavigationTelemetry consumes a lot of resources while working, so I think option 1 is a reasonable tradeoff for us. @LukasPaczos , WDYT?
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.
I'd be in favor of option 2 that matches the existing behavior (avoid processing) and we already have NAVAND-355 that tracks the runtime enable/disable changes which we can tackle separately.
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.
Ok, let's keep current telemetry initialisation as is and improve it in NAVAND-355. Reverted cba98ab
This reverts commit cba98ab.
Co-authored-by: Łukasz Paczos <[email protected]>
TelemetryUtilsDelegate.getEventsCollectionState()can change value in runtime and some of our customers do change it.The switch between true to false while mapbox navigation is alive caused 2 problems:
MapboxMetricsReporterlogged events when telemetry is turned on. This caused the SDK to always get error.MapboxNavigationdidn't stop telemetry inMapboxNavigation.onDestroyNow telemetry always works, but it doesn't send events if disabled