wordpress-mobile / wordpress-mobile/WordPress-Android

[Analytics] Events that aren't implemented properly aren't shown as errors or crashes.

Open
#10,455 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Pri] Low [Type] Enhancement Analytics Good First Issue Tech Debt
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

Expected behavior

Events that aren't implemented properly should show in the log as an error or cause a crash in the debug builds.

@malinajirka made a comment about the rationale behind this in this PR discussion.

The comment :

We are showing a warning in the LogCat when the track event name isn't found: There is NO match for the event. Thinking about it now, we might want to consider crashing the app in debug builds as it's pretty easy to make such mistake - especially for newcomers.

Actual behavior

When you add an event to the Stat enum and the mapping with its value is not implemented here https://github.com/wordpress-mobile/WordPress-Android/blob/04cf520ef21257b9e75a94c4f47941235fd0ad47/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java#L598

it's simply shown as a verbose warning that could be missed.

eg.

2019-08-28 19:22:18.049 25197-25197/org.wordpress.android W/WordPress-STATS: There is NO match for the event ACCOUNT_SETTINGS_CHANGE_USERNAME_FAILEDstat
Steps to reproduce the behavior
  1. Add a new stat here
    https://github.com/wordpress-mobile/WordPress-Android/blob/04cf520ef21257b9e75a94c4f47941235fd0ad47/libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java#L22

  2. Track the stat that's not implemented

AnalyticsTracker.track(ACCOUNT_SETTINGS_CHANGE_USERNAME_FAILED)
  1. You can then filter the log using the log levelverbose flag & WordPress-STATS as the query to see the output.
Tested on [device], Android [version], WPAndroid [version]

Google Pixel 3 XL emulator, Android 9.0, WPAndroid 13.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Stat enum in libs/analytics/WordPressAnalytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java and its mapping in AnalyticsTrackerNosara.java. Reproduce the missing mapping using the issue's steps and verify that an unimplemented event is reported as an error or causes a crash in debug builds instead of only producing a verbose warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
analytics, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.