Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Malformed userAgent in telemetry events #4328

Closed
camilleanne opened this issue Mar 15, 2016 · 8 comments
Closed

Malformed userAgent in telemetry events #4328

camilleanne opened this issue Mar 15, 2016 · 8 comments
Assignees
Labels
Android Mapbox Maps SDK for Android bug telemetry Integration with Mapbox Telemetry libraries

Comments

@camilleanne
Copy link

Seeing events come into staging that look like:
{"event":"appUserTurnstile","created":"2016-03-14T20:46:23.676Z","userId":"{userId}","enabled.telemetry":true,"received":"2016-03-14T20:46:24.359Z","token":"{token}","owner":"bleege","authorization":"{auth}","userAgent":"Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 Mapbox GL/4.0.0/8 MapboxEventsAndroid/4.0.0-SNAPSHOT","version":2,"createdOffset":"+0100"}

cc @bleege

@camilleanne camilleanne added bug Android Mapbox Maps SDK for Android telemetry Integration with Mapbox Telemetry libraries labels Mar 15, 2016
@tobrun tobrun added this to the android-v4.0.0 milestone Mar 15, 2016
@bleege bleege self-assigned this Mar 15, 2016
@bleege
Copy link
Contributor

bleege commented Mar 15, 2016

Good catch @camilleanne. I'll fix this.

@bleege
Copy link
Contributor

bleege commented Mar 18, 2016

Initial inspection seems to indicate a regression due to #4263 and specifically b372bb2d823a397fbfa98317d8c581de93063065.

@bleege
Copy link
Contributor

bleege commented Mar 18, 2016

Also appears to be related to #2816 and 94c5c2e. initialise() may be being called multiple times due to rotation that the previous solo null check on savedInstanceState was being used to avoid.

/cc @tobrun

@bleege
Copy link
Contributor

bleege commented Mar 18, 2016

Added an explicit if (savedInstanceState == null) check before configuring MapboxEventManager to prevent the multiple initialization and subsequent repeated strings in the User Agent when the device is rotated. Will merge to master and then cherry pick to the release-ios-3.2.0-android-4.0.0 branch.

@bleege
Copy link
Contributor

bleege commented Mar 18, 2016

Merged and cherry picked!

screen shot 2016-03-18 at 5 27 07 pm

/cc @jfirebaugh

@tobrun
Copy link
Member

tobrun commented Mar 21, 2016

@bleege
Changes should be reviewed before going on to the release branch?

While the savedInstanceState==null check solves it for most use-cases it will not for all:

  • Having maps in multiple activities in one application
  • User doesn't override onSaveInstanceState and thus not having a savedState when recreating.
  • User shows 2 Mapviews in one screen.

The fix in d33cee7 works around the issue, it doesn't solve the real issue of having a malformed user agent. When you cal initialise on a Singleton it should always produce the same outcome.

@tobrun tobrun reopened this Mar 21, 2016
bleege added a commit that referenced this issue Mar 21, 2016
…nitial state before prepending app meta data to it
@bleege
Copy link
Contributor

bleege commented Mar 21, 2016

Good catch @tobrun! I've just added a state check to userAgent that will further ensure that it only gets set once. Can you 👀 to make sure that it addresses the concerns that you're thinking about?

bleege added a commit that referenced this issue Mar 21, 2016
…nitial state before prepending app meta data to it
bleege added a commit that referenced this issue Mar 21, 2016
…nitial state before prepending app meta data to it
@bleege
Copy link
Contributor

bleege commented Mar 21, 2016

Merged to master via 16a58e8 and cherry picked to release-ios3.2.0-android-4.0.0.

screen shot 2016-03-21 at 3 09 48 pm

/cc @jfirebaugh

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android bug telemetry Integration with Mapbox Telemetry libraries
Projects
None yet
Development

No branches or pull requests

3 participants