Commit 3b1bbf54 authored by Peter Beverloo's avatar Peter Beverloo Committed by Commit Bot

Measure how often options are included with GetToken() calls

We suspect that nobody uses this because it's completely undocumented,
but since it's exposed to developer we should gather metrics for a
little while to confirm.

Change-Id: I57b7b8dcd7e861842bdf81b8b62787f44e62ffbf
Reviewed-on: https://chromium-review.googlesource.com/1209642Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590428}
parent 9417ee25
...@@ -50,11 +50,9 @@ const char* InstanceIDResultToError(instance_id::InstanceID::Result result) { ...@@ -50,11 +50,9 @@ const char* InstanceIDResultToError(instance_id::InstanceID::Result result) {
} // namespace } // namespace
InstanceIDApiFunction::InstanceIDApiFunction() { InstanceIDApiFunction::InstanceIDApiFunction() = default;
}
InstanceIDApiFunction::~InstanceIDApiFunction() { InstanceIDApiFunction::~InstanceIDApiFunction() = default;
}
ExtensionFunction::ResponseAction InstanceIDApiFunction::Run() { ExtensionFunction::ResponseAction InstanceIDApiFunction::Run() {
if (Profile::FromBrowserContext(browser_context())->IsOffTheRecord()) { if (Profile::FromBrowserContext(browser_context())->IsOffTheRecord()) {
...@@ -130,6 +128,9 @@ ExtensionFunction::ResponseAction InstanceIDGetTokenFunction::DoWork() { ...@@ -130,6 +128,9 @@ ExtensionFunction::ResponseAction InstanceIDGetTokenFunction::DoWork() {
if (params->get_token_params.options.get()) if (params->get_token_params.options.get())
options = params->get_token_params.options->additional_properties; options = params->get_token_params.options->additional_properties;
UMA_HISTOGRAM_COUNTS_100("Extensions.InstanceID.GetToken.OptionsCount",
options.size());
GetInstanceID()->GetToken( GetInstanceID()->GetToken(
params->get_token_params.authorized_entity, params->get_token_params.authorized_entity,
params->get_token_params.scope, params->get_token_params.scope,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "jni/InstanceIDBridge_jni.h" #include "jni/InstanceIDBridge_jni.h"
...@@ -95,6 +96,8 @@ void InstanceIDAndroid::GetToken( ...@@ -95,6 +96,8 @@ void InstanceIDAndroid::GetToken(
const GetTokenCallback& callback) { const GetTokenCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
UMA_HISTOGRAM_COUNTS_100("InstanceID.GetToken.OptionsCount", options.size());
int32_t request_id = int32_t request_id =
get_token_callbacks_.Add(std::make_unique<GetTokenCallback>(callback)); get_token_callbacks_.Add(std::make_unique<GetTokenCallback>(callback));
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
...@@ -95,6 +96,8 @@ void InstanceIDImpl::GetToken( ...@@ -95,6 +96,8 @@ void InstanceIDImpl::GetToken(
DCHECK(!authorized_entity.empty()); DCHECK(!authorized_entity.empty());
DCHECK(!scope.empty()); DCHECK(!scope.empty());
UMA_HISTOGRAM_COUNTS_100("InstanceID.GetToken.OptionsCount", options.size());
RunWhenReady(base::Bind(&InstanceIDImpl::DoGetToken, RunWhenReady(base::Bind(&InstanceIDImpl::DoGetToken,
weak_ptr_factory_.GetWeakPtr(), authorized_entity, weak_ptr_factory_.GetWeakPtr(), authorized_entity,
scope, options, callback)); scope, options, callback));
......
...@@ -29883,6 +29883,15 @@ uploading your change for review. ...@@ -29883,6 +29883,15 @@ uploading your change for review.
<summary>Installs grouped by Extension::HistogramType.</summary> <summary>Installs grouped by Extension::HistogramType.</summary>
</histogram> </histogram>
<histogram name="Extensions.InstanceID.GetToken.OptionsCount" units="options"
expires_after="2019-01-30">
<owner>peter@chromium.org</owner>
<summary>
The number of options provided to the GetToken request. Recorded when the
extension has made a call to chrome.instanceID.getToken().
</summary>
</histogram>
<histogram name="Extensions.LoadAll"> <histogram name="Extensions.LoadAll">
<owner>rdevlin.cronin@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner>
<summary>The number of extensions and themes loaded at profile open.</summary> <summary>The number of extensions and themes loaded at profile open.</summary>
...@@ -37263,6 +37272,15 @@ uploading your change for review. ...@@ -37263,6 +37272,15 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="InstanceID.GetToken.OptionsCount" units="options"
expires_after="2019-01-30">
<owner>peter@chromium.org</owner>
<summary>
The number of options provided to the GetToken request. Recorded when the
request has been received by the InstanceID instance.
</summary>
</histogram>
<histogram name="InstanceID.GetToken.RequestStatus" <histogram name="InstanceID.GetToken.RequestStatus"
enum="GCMRegistrationRequestStatus"> enum="GCMRegistrationRequestStatus">
<owner>juyik@chromium.org</owner> <owner>juyik@chromium.org</owner>
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