Skip to content

Conversation

@VysotskiVadim
Copy link
Contributor

@VysotskiVadim VysotskiVadim commented Oct 26, 2022

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:

  1. MapboxMetricsReporter logged events when telemetry is turned on. This caused the SDK to always get error.
  2. MapboxNavigation didn't stop telemetry in MapboxNavigation.onDestroy

Now telemetry always works, but it doesn't send events if disabled

@VysotskiVadim
Copy link
Contributor Author

@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

?

@LukasPaczos
Copy link

@VysotskiVadim we should also refactor EventsServiceObserver to not log the whole events as they could contain routes and other big objects. We should perhaps only log types or other relevant but concise info.

@RingerJK
Copy link
Contributor

we should refactor EventsServiceObserver that it's not log if EventsService is disabled as well

@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #6512 (fa03557) into main (934e668) will decrease coverage by 0.02%.
The diff coverage is 14.28%.

Impacted file tree graph

@@             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              
Impacted Files Coverage Δ
...apbox/navigation/base/internal/metric/ValueUtil.kt 0.00% <0.00%> (ø)
...mapbox/navigation/metrics/MapboxMetricsReporter.kt 46.55% <16.66%> (-5.38%) ⬇️

@VysotskiVadim VysotskiVadim force-pushed the NAVAND-819-vv-do-no-send-events-if-telemetry-is-turned-off branch from 43e4cb3 to 260094d Compare October 26, 2022 17:00
fixed changelog

updated changelog
@VysotskiVadim VysotskiVadim force-pushed the NAVAND-819-vv-do-no-send-events-if-telemetry-is-turned-off branch from e27c12a to 2d31b2a Compare October 26, 2022 17:08
@VysotskiVadim VysotskiVadim marked this pull request as ready for review October 26, 2022 17:14
@VysotskiVadim VysotskiVadim requested a review from a team as a code owner October 26, 2022 17:14
"MapboxMetricsReporter.init from MapboxNavigation main",
MapboxNavigationTelemetry.LOG_CATEGORY
)
MapboxMetricsReporter.init(
Copy link
Contributor

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.

Copy link
Contributor Author

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

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(

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?

Copy link
Contributor Author

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:

  • MapboxNavigationTelemetry works but events aren't sent when telemetry is disabled

2. Initiaize MapboxNavigationTelemetry only when telemetry is turned on, always disable on destroy

pros:

  • MapboxNavigationTelemetry doesn'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
  • MapboxNavigationTelemetry doesn'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?

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.

Copy link
Contributor Author

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

Co-authored-by: Łukasz Paczos <[email protected]>
@VysotskiVadim VysotskiVadim enabled auto-merge (squash) October 27, 2022 10:51
@VysotskiVadim VysotskiVadim merged commit 4557c36 into main Oct 27, 2022
@VysotskiVadim VysotskiVadim deleted the NAVAND-819-vv-do-no-send-events-if-telemetry-is-turned-off branch October 27, 2022 11:26
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.

4 participants