Skip to content

Conversation

@RingerJK
Copy link
Contributor

@RingerJK RingerJK commented Sep 30, 2022

Description

migrating to core telemetry

blocked by #6422

@RingerJK RingerJK requested a review from a team as a code owner September 30, 2022 17:32
@RingerJK RingerJK self-assigned this Sep 30, 2022
@RingerJK RingerJK added the skip changelog Should not be added into version changelog. label Sep 30, 2022
@RingerJK RingerJK changed the title Kyv navand 647 core telemerty migration Core telemetry migration Sep 30, 2022
@RingerJK RingerJK force-pushed the kyv-NAVAND-647-core-telemerty-migration branch 2 times, most recently from 3afb1c4 to 076ed39 Compare September 30, 2022 18:02
@RingerJK RingerJK added the blocked Blocked by dependency or unclarity. label Sep 30, 2022
@RingerJK RingerJK marked this pull request as draft October 3, 2022 06:26
@RingerJK RingerJK force-pushed the kyv-NAVAND-647-core-telemerty-migration branch from 076ed39 to c296c41 Compare October 3, 2022 21:50
@RingerJK RingerJK removed the blocked Blocked by dependency or unclarity. label Oct 3, 2022
@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #6423 (2c9df75) into main (0e32735) will increase coverage by 0.06%.
The diff coverage is 69.33%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #6423      +/-   ##
============================================
+ Coverage     69.42%   69.49%   +0.06%     
- Complexity     4653     4707      +54     
============================================
  Files           697      700       +3     
  Lines         27520    27703     +183     
  Branches       3205     3255      +50     
============================================
+ Hits          19107    19251     +144     
+ Misses         7169     7166       -3     
- Partials       1244     1286      +42     
Impacted Files Coverage Δ
...ava/com/mapbox/navigation/core/MapboxNavigation.kt 67.57% <0.00%> (ø)
...navigation/core/telemetry/NavEventsPopulateUtil.kt 94.59% <ø> (ø)
...box/navigation/core/telemetry/events/PhoneState.kt 100.00% <ø> (ø)
...vigation/metrics/internal/EventsServiceProvider.kt 0.00% <0.00%> (ø)
...ation/metrics/internal/TelemetryServiceProvider.kt 0.00% <0.00%> (ø)
...igation/metrics/internal/TelemetryUtilsDelegate.kt 0.00% <0.00%> (ø)
...n/core/telemetry/events/NavigationFeedbackEvent.kt 72.00% <41.66%> (-28.00%) ⬇️
...mapbox/navigation/metrics/MapboxMetricsReporter.kt 54.00% <47.22%> (-10.00%) ⬇️
...on/core/telemetry/events/NavigationRerouteEvent.kt 82.60% <66.66%> (-9.06%) ⬇️
.../core/telemetry/events/NavigationFreeDriveEvent.kt 82.35% <70.83%> (-4.32%) ⬇️
... and 16 more

@RingerJK RingerJK marked this pull request as ready for review October 4, 2022 21:57
@RingerJK RingerJK added the release blocker Needs to be resolved before the release. label Oct 5, 2022
mapboxSdkDirectionsModels : "com.mapbox.mapboxsdk:mapbox-sdk-directions-models:${version.mapboxSdkServices}",
mapboxSdkRefreshModels : "com.mapbox.mapboxsdk:mapbox-sdk-directions-refresh-models:${version.mapboxSdkServices}",
mapboxEvents : "com.mapbox.mapboxsdk:mapbox-android-telemetry:${version.mapboxEvents}",
mapboxCore : "com.mapbox.mapboxsdk:mapbox-android-core:${version.mapboxCore}",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be removed, doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we can, let me check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we cannot, following classes are part of mapbox-android-core:

  • com.mapbox.android.core.location.LocationEngine;
  • com.mapbox.android.core.location.LocationEngineRequest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't we planning to reintroduce this same classes under the same packages but directly from the Common SDK @tarigo @tatiana-yan?

In the current situation, we'd still need to maintain https://github.com/mapbox/mapbox-events-android/.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have com.mapbox.common.location.compat.LocationEngine, com.mapbox.common.location.compat.LocationEngineRequest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see https://github.com/mapbox/mapbox-sdk-common/issues/2807 is still open (I can't find corresponding JIRA ticket).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that Nav SDK cannot drop the dependency on MME (at least the location part) because LocationEngine and LocationEngineRequest are part of our public API.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss this separately, it doesn't block the PR.

Copy link

@tarigo tarigo Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the external customers there is a plan to replace it by renaming Common's LocationEngine compat, you can keep core dependency because it's a public API but migrate to compat - it would be great to test it, but from the next release - there are some issues to address.
Maps SDK has already adopted it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref CORESDK-465

@RingerJK RingerJK requested a review from LukasPaczos October 5, 2022 18:35

/**
* Disables metrics reporting and ends [mapboxTelemetry] session.
* Disables metrics reporting and ends [EventsServiceInterface] and [TelemetryService] session.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current implementation does not stop EventsService and TelemetryService.

What should this method do? If it must stop interaction and location events sending (for the entire application and all Mapbox SDKs we have in the application) we need to setEventsCollectionState(false) here.
If it should not stop events collection we need to remove Disables metrics reporting and ends [EventsServiceInterface] and [TelemetryService] session. from method description.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to setEventsCollectionState(false) here.

@tatiana-yan then it stops collecting metrics from every single SDK (nav, maps, search), right? It's not fit for the current method, let's change the description

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it will stop all except turnstiles for all SDKs. if you want to stop navigation events only, you can set some internal flag to ignore events sending
And is there some use-case when we need to stop collecting navigation events but not maps/search/locations? In that case, user should have independent settings to opt-out from maps/nav/search which looks unlikely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that any customers use this API, but since it's public we should respect it. I'll add internal falgs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we're not recommending using this API at all. To align the API I'll add internal flags 👍

And is there some use-case when we need to stop collecting navigation events but not maps/search/locations?

don't think this must be done via MapboxReporter API

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capturing from a chat, @RingerJK to cut a ticket to discuss our recommendations on how developers/end-users should opt-out of telemetry collection (since TelemetryUtils#setEventsCollectionState is documented as internal). Not a blocker for this PR but has to be resolved before the changes go stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref CORESDK-1357

Comment on lines +117 to +119
ioJobController.scope.launch {
metricsObserver?.onMetricUpdated(metricEvent.metricName, metricEvent.toJson(gson))
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this on a worker thread? I found the original PR in #2237 but it has no context. Documentation for the interface doesn't mention that it'll be called from a worker.

Not a blocker here, just something I noticed to discuss 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.

ref NAVAND-730

Copy link
Contributor

@VysotskiVadim VysotskiVadim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any critical issues in code, but I can't do a proper review as I haven't undrstood yet how telemetry works 🙂

Copy link

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a note that there are some open threads that need to be addressed before these changes go stable.

@RingerJK RingerJK merged commit a2bf593 into main Oct 6, 2022
@RingerJK RingerJK deleted the kyv-NAVAND-647-core-telemerty-migration branch October 6, 2022 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release blocker Needs to be resolved before the release. skip changelog Should not be added into version changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants