Commit c3861022 authored by Rayan Kanso's avatar Rayan Kanso Committed by Commit Bot

[WebAPK] Collect RequestTokenDurationV2 for new webapks.

WebAPKs using the new minting mechanism, identified by their package
name, should have a separate latency histogram to track if overall
latency will be affected.

Bug: 1134173
Change-Id: Ib75ec57828c1df1f038c2a1bf383a52cc602647f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443011Reviewed-by: default avatarGlenn Hartmann <hartmanng@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarPeter Kotwicz <pkotwicz@chromium.org>
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Auto-Submit: Rayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812842}
parent 2e8ed515
...@@ -478,7 +478,8 @@ void WebApkInstaller::InstallOrUpdateWebApk(const std::string& package_name, ...@@ -478,7 +478,8 @@ void WebApkInstaller::InstallOrUpdateWebApk(const std::string& package_name,
base::android::ConvertUTF8ToJavaString(env, token); base::android::ConvertUTF8ToJavaString(env, token);
if (task_type_ == WebApkInstaller::INSTALL) { if (task_type_ == WebApkInstaller::INSTALL) {
webapk::TrackRequestTokenDuration(install_duration_timer_->Elapsed()); webapk::TrackRequestTokenDuration(install_duration_timer_->Elapsed(),
package_name);
base::android::ScopedJavaLocalRef<jobject> java_primary_icon = base::android::ScopedJavaLocalRef<jobject> java_primary_icon =
gfx::ConvertToJavaBitmap(&install_primary_icon_); gfx::ConvertToJavaBitmap(&install_primary_icon_);
Java_WebApkInstaller_installWebApkAsync( Java_WebApkInstaller_installWebApkAsync(
......
...@@ -5,14 +5,18 @@ ...@@ -5,14 +5,18 @@
#include "chrome/browser/android/webapk/webapk_metrics.h" #include "chrome/browser/android/webapk/webapk_metrics.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/time/time.h" #include "base/strings/string_util.h"
namespace webapk { namespace webapk {
const char kInstallDurationHistogram[] = "WebApk.Install.InstallDuration"; const char kInstallDurationHistogram[] = "WebApk.Install.InstallDuration";
const char kInstallEventHistogram[] = "WebApk.Install.InstallEvent"; const char kInstallEventHistogram[] = "WebApk.Install.InstallEvent";
void TrackRequestTokenDuration(base::TimeDelta delta) { void TrackRequestTokenDuration(base::TimeDelta delta,
const std::string& webapk_package) {
if (base::EndsWith(webapk_package, "_v2"))
UMA_HISTOGRAM_MEDIUM_TIMES("WebApk.Install.RequestTokenDurationV2", delta);
else
UMA_HISTOGRAM_TIMES("WebApk.Install.RequestTokenDuration", delta); UMA_HISTOGRAM_TIMES("WebApk.Install.RequestTokenDuration", delta);
} }
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_METRICS_H_ #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_METRICS_H_
#define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_METRICS_H_ #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_METRICS_H_
namespace base { #include <string>
class TimeDelta;
} #include "base/time/time.h"
namespace webapk { namespace webapk {
...@@ -25,7 +25,8 @@ enum InstallEvent { ...@@ -25,7 +25,8 @@ enum InstallEvent {
INSTALL_EVENT_MAX = 5, INSTALL_EVENT_MAX = 5,
}; };
void TrackRequestTokenDuration(base::TimeDelta delta); void TrackRequestTokenDuration(base::TimeDelta delta,
const std::string& webapk_package);
void TrackInstallDuration(base::TimeDelta delta); void TrackInstallDuration(base::TimeDelta delta);
void TrackInstallEvent(InstallEvent event); void TrackInstallEvent(InstallEvent event);
......
...@@ -104,6 +104,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -104,6 +104,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="WebApk.Install.RequestTokenDuration" units="ms" <histogram name="WebApk.Install.RequestTokenDuration" units="ms"
expires_after="2021-03-15"> expires_after="2021-03-15">
<owner>hartmanng@chromium.org</owner> <owner>hartmanng@chromium.org</owner>
<owner>rayankans@chromium.org</owner>
<owner> <owner>
src/chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS src/chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS
</owner> </owner>
...@@ -116,6 +117,19 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -116,6 +117,19 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="WebApk.Install.RequestTokenDurationV2" units="ms"
expires_after="2021-03-15">
<owner>hartmanng@chromium.org</owner>
<owner>rayankans@chromium.org</owner>
<owner>
src/chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS
</owner>
<summary>
Same as WebApk.Install.RequestTokenDuration, but for WebAPKs minted using
the new architecture (v2).
</summary>
</histogram>
<histogram name="WebApk.Launch.NetworkError" enum="NetErrorCodes" <histogram name="WebApk.Launch.NetworkError" enum="NetErrorCodes"
expires_after="2021-02-01"> expires_after="2021-02-01">
<owner>hartmanng@chromium.org</owner> <owner>hartmanng@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