Commit 46bf7d25 authored by Meilin Wang's avatar Meilin Wang Committed by Commit Bot

Add count UMA metrics for eligible/enabled users.

Record the number of users who enabled/disabled Assistant service on their
devices, the sum would be the number of all eligible users. Note that
we simply report this metrics with every UMA upload and should only depend
on unique users count to take advantage of the de-dupe logic implemented
on the server-side. Ignore potential reboot or crash for now.

Test: local compile and manually test.
Bug: b:117518834
Change-Id: I5cee656db986f60104999502b4feebb8d072c79f
Reviewed-on: https://chromium-review.googlesource.com/c/1292111
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610229}
parent 36dbfd79
......@@ -3133,6 +3133,8 @@ jumbo_split_static_library("browser") {
"memory/memory_kills_histogram.h",
"memory/memory_kills_monitor.cc",
"memory/memory_kills_monitor.h",
"metrics/assistant_service_metrics_provider.cc",
"metrics/assistant_service_metrics_provider.h",
"metrics/chromeos_metrics_provider.cc",
"metrics/chromeos_metrics_provider.h",
"metrics/perf/cpu_identity.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/metrics/assistant_service_metrics_provider.h"
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "components/arc/arc_prefs.h"
#include "components/prefs/pref_service.h"
AssistantServiceMetricsProvider::AssistantServiceMetricsProvider() = default;
AssistantServiceMetricsProvider::~AssistantServiceMetricsProvider() = default;
void AssistantServiceMetricsProvider::ProvideCurrentSessionData(
metrics::ChromeUserMetricsExtension* uma_proto_unused) {
if (arc::IsAssistantAllowedForProfile(
ProfileManager::GetActiveUserProfile()) !=
ash::mojom::AssistantAllowedState::ALLOWED) {
return;
}
UMA_HISTOGRAM_BOOLEAN(
"Assistant.ServiceEnabledUserCount",
ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
arc::prefs::kVoiceInteractionEnabled));
}
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_METRICS_ASSISTANT_SERVICE_METRICS_PROVIDER_H_
#define CHROME_BROWSER_METRICS_ASSISTANT_SERVICE_METRICS_PROVIDER_H_
#include "components/metrics/metrics_provider.h"
class AssistantServiceMetricsProvider : public metrics::MetricsProvider {
public:
AssistantServiceMetricsProvider();
~AssistantServiceMetricsProvider() override;
// metrics::MetricsProvider:
void ProvideCurrentSessionData(
metrics::ChromeUserMetricsExtension* uma_proto_unused) override;
private:
DISALLOW_COPY_AND_ASSIGN(AssistantServiceMetricsProvider);
};
#endif // CHROME_BROWSER_METRICS_ASSISTANT_SERVICE_METRICS_PROVIDER_H_
......@@ -58,6 +58,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/util_constants.h"
#include "chromeos/assistant/buildflags.h"
#include "components/browser_sync/profile_sync_service.h"
#include "components/browser_watcher/stability_paths.h"
#include "components/crash/core/common/crash_keys.h"
......@@ -123,6 +124,10 @@
#include "chrome/browser/metrics/plugin_metrics_provider.h"
#endif
#if BUILDFLAG(ENABLE_CROS_ASSISTANT)
#include "chrome/browser/metrics/assistant_service_metrics_provider.h"
#endif
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/printing/printer_metrics_provider.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
......@@ -721,6 +726,11 @@ void ChromeMetricsServiceClient::RegisterMetricsServiceProviders() {
metrics_service_->RegisterMetricsProvider(
std::make_unique<PowerMetricsProvider>());
#endif
#if BUILDFLAG(ENABLE_CROS_ASSISTANT)
metrics_service_->RegisterMetricsProvider(
std::make_unique<AssistantServiceMetricsProvider>());
#endif // BUILDFLAG(ENABLE_CROS_ASSISTANT)
}
void ChromeMetricsServiceClient::RegisterUKMProviders() {
......
......@@ -5587,6 +5587,18 @@ uploading your change for review.
<summary>Number of queries fired for each entry point.</summary>
</histogram>
<histogram name="Assistant.ServiceEnabledUserCount" enum="BooleanEnabled"
expires_after="2019-11-13">
<owner>xiaohuic@chromium.org</owner>
<owner>meilinw@chromium.org</owner>
<summary>
Among eligible users, whether the user has the Assistant service enabled.
Recorded once for every UMA upload. The set of eligible users includes all
users with profiles that can allow Assistant service to be enabled
(AssistantAllowedState is limited by locale, policy, etc).
</summary>
</histogram>
<histogram name="Assistant.ServiceStartTime" units="ms">
<owner>updowndota@chromium.org</owner>
<summary>Amount of time spent in starting Assistant service.</summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment