Skip to content
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

Improve some P3A metrics #3931

Merged
merged 4 commits into from
Jan 3, 2020
Merged

Improve some P3A metrics #3931

merged 4 commits into from
Jan 3, 2020

Conversation

iefremov
Copy link
Contributor

@iefremov iefremov commented Nov 8, 2019

Fixes brave/brave-browser#6841
Fixes brave/brave-browser#7253

Submitter Checklist:

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@iefremov
Copy link
Contributor Author

iefremov commented Dec 9, 2019

@tmancey @NejcZdovc PTAL

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM++

@@ -50,6 +50,10 @@ void RecordAdsState(AdsP3AState state);
void UpdateAdsP3AOnPreferenceChange(PrefService* prefs,
const std::string& pref);

// Records an initial metric state ("disabled" or "enabled") if it was not done
// before. Intended to be called if the user has already created a wallet.
void MaybeRecordInitialAdsP3AState(PrefService* local_state);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be prefs instead of local_state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, currently all metrics are intentionally stored in global state, so using it here is also fine. Atm we are ok with it

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I should be more clear. I am talking about variable name. Because in h file you have MaybeRecordInitialAdsP3AState(PrefService* local_state), but in cc you have MaybeRecordInitialAdsP3AState(PrefService* prefs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, thanks, good catch

Copy link
Contributor

@NejcZdovc NejcZdovc left a comment

Choose a reason for hiding this comment

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

left a comment about a variable name, but not a blocker

@iefremov
Copy link
Contributor Author

Thanks @tmancey @NejcZdovc

@bsclifton bsclifton added this to the 1.4.x - Nightly milestone Dec 13, 2019
@bsclifton bsclifton added CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows labels Dec 17, 2019
@bsclifton
Copy link
Member

Ran into GLIBC error on Linux ☹️

@bsclifton
Copy link
Member

Rebased - CI is running again for Linux 😄 GLIBC problem has been resolved (not related to this PR). Should be able to merge this soon and uplift to 1.2

Ivan Efremov added 4 commits January 2, 2020 19:45
We want only two buckets instead of the Chromium default ones,
so the existing histogram is transformed according to our needs.
We were recording a wrong value ("No wallet") even if the user already
had had a wallet in place. Now we try to properly record it and do it
only once with the help of an additional flag.
@iefremov iefremov merged commit 7dd7b6a into master Jan 3, 2020
@iefremov iefremov deleted the ie_p3a_fix branch January 3, 2020 07:58
@NejcZdovc NejcZdovc modified the milestones: 1.4.x - Dev, 1.5.x - Nightly Jan 3, 2020
brave-builds pushed a commit that referenced this pull request Jan 3, 2020
@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Jan 17, 2020

Verification passed with Windows 10 x64 using

Brave 1.5.43 Chromium: 79.0.3945.130 (Official Build) nightly (64-bit)
Revision e22de67c28798d98833a7137c0e22876237fc40a-refs/branch-heads/3945@{#1047}
OS Windows 10 OS Version 1803 (Build 17134.1006)

metric Brave.Core.IsDefault

  • Ensured default browser response value is displayed as Yes when brave is the default browser in a clean profile
  • Ensured default browser response value is displayed as No when brave isn’t a default browser in a clean profile
  • Ensured default browser response value is displayed as No when brave isn’t a default browser in upgraded profile. (The metric DefaultBrowser.state is renamed to Brave.Core.IsDefault in upgraded profile)
  • Ensured default browser response value is displayed as Yes when brave is set as the default browser in an upgraded profile
  • Set Brave as the default browser in 1.2.42 and verify the response value Yes for metric DefaultBrowser.state and then upgraded to 1.5.43 and ensure that the response value remained unchanged

metric Brave.Rewards.AdsState - brave/brave-browser#7253

  • Ensured response value is displayed as expected when no wallet is created in a clean profile
  • Ensured response value is displayed as expected when wallet created and ads enabled in a clean profile
  • Ensured response value is displayed as expected in clean profile when wallet created, ads enabled, then disabled while brave rewards is ON
  • Ensured response value is displayed as expected in clean profile when wallet created, ads enabled, then disabled, brave rewards disabled
  • Ensured response value is displayed as 1 in an upgraded profile when the wallet was created, ads enabled, then disabled in 1.2.42 and then upgrade to 1.5.43
  • Ensured response value is displayed as 2 in an upgraded profile when the wallet was created in 1.2.42 and then upgrade to 1.5.43
  • Ensured response value is displayed as 1 in an upgraded profile when the wallet was created and disabled rewards in version 1.2.42 and then upgrade to 1.5.43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P3A - Ads response value isn't updated correctly in upgraded profile Improve some P3A metrics
5 participants