Skip to content

Commit 693b54c

Browse files
authored
Remove arch from daily usage ping (#34277)
* Remove arch from daily usage ping * Fix formatting * Fix GN check and DEPS for brave_stats_updater_util include
1 parent 8890ae2 commit 693b54c

File tree

11 files changed

+57
-164
lines changed

11 files changed

+57
-164
lines changed

browser/DEPS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ specific_include_rules = {
135135
"brave_browser_process_impl\.cc": [
136136
"+brave/components/brave_component_updater/browser/brave_component_updater_delegate.h",
137137
"+brave/components/brave_component_updater/browser/local_data_files_service.h",
138+
"+brave/components/brave_stats/browser/brave_stats_updater_util.h",
138139
],
139140
"brave_browser_process_impl\.h": [
140141
"+brave/components/brave_component_updater/browser/brave_component.h",

browser/brave_browser_process_impl.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "brave/components/brave_shields/content/browser/ad_block_service.h"
3333
#include "brave/components/brave_shields/content/browser/ad_block_subscription_service_manager.h"
3434
#include "brave/components/brave_shields/core/common/features.h"
35+
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
3536
#include "brave/components/brave_sync/network_time_helper.h"
3637
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
3738
#include "brave/components/constants/pref_names.h"

browser/brave_stats/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ source_set("brave_stats") {
2626
"//brave/browser/brave_stats/switches.h",
2727
]
2828

29+
public_deps = [ "//brave/components/brave_stats/browser" ]
30+
2931
deps = [
3032
"//base",
3133
"//brave/browser:browser_process",
@@ -34,11 +36,9 @@ source_set("brave_stats") {
3436
"//brave/common",
3537
"//brave/components/brave_ads/buildflags",
3638
"//brave/components/brave_referrals/common",
37-
"//brave/components/brave_stats/browser",
3839
"//brave/components/brave_wallet/common/buildflags",
3940
"//brave/components/constants",
4041
"//brave/components/misc_metrics",
41-
"//brave/components/rpill/common",
4242
"//brave/components/serp_metrics",
4343
"//brave/components/version_info",
4444
"//chrome/browser:browser_process",

browser/brave_stats/DEPS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
include_rules = [
22
"+brave/components/brave_referrals/common",
33
"+brave/components/brave_stats/browser",
4-
"+brave/components/rpill/common",
54
"+brave/components/version_info",
65
]

browser/brave_stats/brave_stats_updater.cc

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "base/memory/scoped_refptr.h"
1919
#include "base/metrics/histogram_macros.h"
2020
#include "base/strings/string_util.h"
21-
#include "base/system/sys_info.h"
2221
#include "brave/browser/brave_browser_features.h"
2322
#include "brave/browser/brave_stats/brave_stats_updater_params.h"
2423
#include "brave/browser/brave_stats/buildflags.h"
@@ -28,14 +27,12 @@
2827
#include "brave/browser/misc_metrics/profile_misc_metrics_service.h"
2928
#include "brave/browser/misc_metrics/profile_misc_metrics_service_factory.h"
3029
#include "brave/common/brave_channel_info.h"
31-
#include "brave/components/brave_ads/buildflags/buildflags.h"
3230
#include "brave/components/brave_referrals/common/pref_names.h"
3331
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
3432
#include "brave/components/brave_wallet/common/buildflags/buildflags.h"
3533
#include "brave/components/constants/network_constants.h"
3634
#include "brave/components/constants/pref_names.h"
3735
#include "brave/components/misc_metrics/general_browser_usage.h"
38-
#include "brave/components/rpill/common/rpill.h"
3936
#include "brave/components/serp_metrics/serp_metrics.h"
4037
#include "brave/components/version_info/version_info.h"
4138
#include "chrome/browser/browser_process.h"
@@ -56,10 +53,6 @@
5653
#include "services/network/public/cpp/simple_url_loader.h"
5754
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
5855

59-
#if BUILDFLAG(ENABLE_BRAVE_ADS)
60-
#include "brave/components/brave_ads/core/public/prefs/pref_names.h"
61-
#endif
62-
6356
#if BUILDFLAG(ENABLE_BRAVE_WALLET)
6457
#include "brave/components/brave_wallet/browser/pref_names.h"
6558
#endif
@@ -288,22 +281,13 @@ bool BraveStatsUpdater::IsReferralInitialized() {
288281
pref_service_->GetBoolean(kReferralCheckedForPromoCodeFile);
289282
}
290283

291-
bool BraveStatsUpdater::IsAdsEnabled() {
292-
#if BUILDFLAG(ENABLE_BRAVE_ADS)
293-
return pref_service_->GetBoolean(brave_ads::prefs::kEnabledForLastProfile);
294-
#else
295-
return false;
296-
#endif
297-
}
298-
299284
void BraveStatsUpdater::OnProfileAdded(Profile* profile) {
300285
general_browser_usage_p3a_->ReportProfileCount(
301286
g_browser_process->profile_manager()->GetNumberOfProfiles());
302287
}
303288

304289
void BraveStatsUpdater::QueueServerPing() {
305290
const bool referrals_initialized = IsReferralInitialized();
306-
const bool ads_enabled = IsAdsEnabled();
307291
int num_closures = 0;
308292

309293
// Note: We don't have the callbacks here because otherwise there is a race
@@ -312,9 +296,6 @@ void BraveStatsUpdater::QueueServerPing() {
312296
if (!referrals_initialized) {
313297
++num_closures;
314298
}
315-
if (ads_enabled) {
316-
++num_closures;
317-
}
318299

319300
// Note: If num_closures == 0, the callback runs immediately
320301
stats_preconditions_barrier_ = base::BarrierClosure(
@@ -329,16 +310,6 @@ void BraveStatsUpdater::QueueServerPing() {
329310
base::BindRepeating(&BraveStatsUpdater::OnReferralInitialization,
330311
base::Unretained(this)));
331312
}
332-
333-
if (ads_enabled) {
334-
DetectUncertainFuture();
335-
}
336-
}
337-
338-
void BraveStatsUpdater::DetectUncertainFuture() {
339-
brave_rpill::DetectUncertainFuture(
340-
base::BindOnce(&BraveStatsUpdater::OnDetectUncertainFuture,
341-
weak_ptr_factory_.GetWeakPtr()));
342313
}
343314

344315
void BraveStatsUpdater::OnReferralInitialization() {
@@ -348,18 +319,6 @@ void BraveStatsUpdater::OnReferralInitialization() {
348319
}
349320
}
350321

351-
void BraveStatsUpdater::OnDetectUncertainFuture(
352-
const bool is_uncertain_future) {
353-
if (is_uncertain_future) {
354-
arch_ = ProcessArch::kArchVirt;
355-
} else {
356-
arch_ = ProcessArch::kArchMetal;
357-
}
358-
if (stats_preconditions_barrier_) {
359-
stats_preconditions_barrier_.Run();
360-
}
361-
}
362-
363322
void BraveStatsUpdater::StartServerPingStartupTimer() {
364323
stats_preconditions_barrier_.Reset();
365324
stats_startup_complete_ = true;
@@ -375,7 +334,7 @@ void BraveStatsUpdater::SendServerPing() {
375334

376335
auto stats_updater_params =
377336
std::make_unique<brave_stats::BraveStatsUpdaterParams>(
378-
pref_service_, GetSerpMetrics(profile_manager_), arch_);
337+
pref_service_, GetSerpMetrics(profile_manager_));
379338
auto endpoint = BuildStatsEndpoint(kBraveUsageStandardPath);
380339
resource_request->url = GetUpdateURL(endpoint, *stats_updater_params);
381340
resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit;

browser/brave_stats/brave_stats_updater.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "base/memory/scoped_refptr.h"
1515
#include "base/memory/weak_ptr.h"
1616
#include "base/scoped_observation.h"
17-
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
1817
#include "chrome/browser/profiles/profile_manager_observer.h"
1918
#include "services/network/public/cpp/shared_url_loader_factory.h"
2019
#include "url/gurl.h"
@@ -84,15 +83,10 @@ class BraveStatsUpdater : public ProfileManagerObserver {
8483
// Invoked after browser has initialized with referral server.
8584
void OnReferralInitialization();
8685

87-
// Invoked after brave ads initializes
88-
void OnDetectUncertainFuture(const bool is_uncertain_future);
89-
90-
void DetectUncertainFuture();
9186
void StartServerPingStartupTimer();
9287
void QueueServerPing();
9388
void SendServerPing();
9489

95-
bool IsAdsEnabled();
9690
bool IsReferralInitialized();
9791

9892
// ProfileManagerObserver:
@@ -102,7 +96,6 @@ class BraveStatsUpdater : public ProfileManagerObserver {
10296

10397
friend class ::BraveStatsUpdaterBrowserTest;
10498

105-
ProcessArch arch_ = ProcessArch::kArchSkip;
10699
bool stats_startup_complete_ = false;
107100
raw_ptr<PrefService> pref_service_ = nullptr;
108101
raw_ptr<ProfileManager> profile_manager_ = nullptr;

browser/brave_stats/brave_stats_updater_params.cc

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "base/logging.h"
1111
#include "base/strings/string_number_conversions.h"
1212
#include "base/strings/string_util.h"
13-
#include "base/system/sys_info.h"
1413
#include "base/time/time.h"
1514
#include "brave/browser/brave_stats/features.h"
1615
#include "brave/browser/brave_stats/first_run_util.h"
@@ -46,25 +45,21 @@ bool IsHeadlessOrAutomationMode() {
4645

4746
BraveStatsUpdaterParams::BraveStatsUpdaterParams(
4847
PrefService* stats_pref_service,
49-
serp_metrics::SerpMetrics* serp_metrics,
50-
const ProcessArch arch)
48+
serp_metrics::SerpMetrics* serp_metrics)
5149
: BraveStatsUpdaterParams(stats_pref_service,
5250
serp_metrics,
53-
arch,
5451
GetCurrentDateAsYMD(),
5552
GetCurrentISOWeekNumber(),
5653
GetCurrentMonth()) {}
5754

5855
BraveStatsUpdaterParams::BraveStatsUpdaterParams(
5956
PrefService* stats_pref_service,
6057
serp_metrics::SerpMetrics* serp_metrics,
61-
const ProcessArch arch,
6258
const std::string& ymd,
6359
int woy,
6460
int month)
6561
: stats_pref_service_(stats_pref_service),
6662
serp_metrics_(serp_metrics),
67-
arch_(arch),
6863
ymd_(ymd),
6964
woy_(woy),
7065
month_(month) {
@@ -115,16 +110,6 @@ std::string BraveStatsUpdaterParams::GetAdsEnabledParam() const {
115110
}
116111
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
117112

118-
std::string BraveStatsUpdaterParams::GetProcessArchParam() const {
119-
if (arch_ == ProcessArch::kArchSkip) {
120-
return "";
121-
} else if (arch_ == ProcessArch::kArchMetal) {
122-
return base::SysInfo::OperatingSystemArchitecture();
123-
} else {
124-
return "virt";
125-
}
126-
}
127-
128113
void BraveStatsUpdaterParams::LoadPrefs() {
129114
last_check_ymd_ = stats_pref_service_->GetString(kLastCheckYMD);
130115
last_check_woy_ = stats_pref_service_->GetInteger(kLastCheckWOY);
@@ -217,9 +202,6 @@ GURL BraveStatsUpdaterParams::GetUpdateURL(
217202
update_url =
218203
net::AppendQueryParameter(update_url, "adsEnabled", GetAdsEnabledParam());
219204
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
220-
update_url =
221-
net::AppendQueryParameter(update_url, "arch", GetProcessArchParam());
222-
223205
if (serp_metrics_ && ymd_ != last_check_ymd_) {
224206
// If `kSerpMetricsFeature` is disabled, `serp_metrics_` will be null and
225207
// SERP metrics will not be reported.

browser/brave_stats/brave_stats_updater_params.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "base/memory/raw_ptr.h"
1515
#include "base/time/time.h"
1616
#include "brave/components/brave_ads/buildflags/buildflags.h"
17-
#include "brave/components/brave_stats/browser/brave_stats_updater_util.h"
1817

1918
class BraveStatsUpdaterTest;
2019
class GURL;
@@ -33,11 +32,9 @@ bool IsHeadlessOrAutomationMode();
3332
class BraveStatsUpdaterParams {
3433
public:
3534
explicit BraveStatsUpdaterParams(PrefService* stats_pref_service,
36-
serp_metrics::SerpMetrics* serp_metrics,
37-
const ProcessArch arch);
35+
serp_metrics::SerpMetrics* serp_metrics);
3836
BraveStatsUpdaterParams(PrefService* stats_pref_service,
3937
serp_metrics::SerpMetrics* serp_metrics,
40-
const ProcessArch arch,
4138
const std::string& ymd,
4239
int woy,
4340
int month);
@@ -55,7 +52,6 @@ class BraveStatsUpdaterParams {
5552
#if BUILDFLAG(ENABLE_BRAVE_ADS)
5653
std::string GetAdsEnabledParam() const;
5754
#endif // BUILDFLAG(ENABLE_BRAVE_ADS)
58-
std::string GetProcessArchParam() const;
5955
GURL GetUpdateURL(const GURL& base_update_url,
6056
std::string_view platform_id,
6157
std::string_view channel_name,
@@ -68,7 +64,6 @@ class BraveStatsUpdaterParams {
6864

6965
raw_ptr<PrefService> stats_pref_service_ = nullptr;
7066
const raw_ptr<serp_metrics::SerpMetrics> serp_metrics_;
71-
ProcessArch arch_;
7267
std::string ymd_;
7368
int woy_;
7469
int month_;

0 commit comments

Comments
 (0)