Commit 68aef128 authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Add UKM for quality enforcement violations

The UKM added is similar as the existing UMA metrics
TrustedWebActivity.QualityEnforcementViolation.
Add the UKM to help us identify popular sites that violate the
quality criteria often.

New UKM collection review:
https://docs.google.com/document/d/1zBXtJ9D8JBbBNtNdQhWhjHMz0Lry3h5MCgUOpxphfCs/edit#

This CL also fixes a bug with the QualityEnforcementViolation UMA:
When record the "Crashed" metric, the general metric will also be
recorded again.
Luckily we are not enabled the crashing part , so there should have
impact on the collected data.

Bug: 1147483
Change-Id: Id250c7037e951558be12186568f5520d48528354
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2530591Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826973}
parent d481eea7
......@@ -125,7 +125,7 @@ public class QualityEnforcer {
private void trigger(
Tab tab, @QualityEnforcementViolationType int type, String url, int httpStatusCode) {
mUmaRecorder.recordQualityEnforcementViolation(type, false /* crashed */);
mUmaRecorder.recordQualityEnforcementViolation(tab, type);
if (ChromeFeatureList.isEnabled(
ChromeFeatureList.TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT_WARNING)) {
......@@ -156,7 +156,7 @@ public class QualityEnforcer {
if (ChromeFeatureList.isEnabled(
ChromeFeatureList.TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT_FORCED)
|| success) {
mUmaRecorder.recordQualityEnforcementViolation(type, true /* crashed */);
mUmaRecorder.recordQualityEnforcementViolationCrashed(type);
mActivity.finish();
}
}
......
......@@ -215,13 +215,20 @@ public class TrustedWebActivityUmaRecorder {
}
public void recordQualityEnforcementViolation(
@QualityEnforcementViolationType int type, boolean crashed) {
Tab tab, @QualityEnforcementViolationType int type) {
RecordHistogram.recordEnumeratedHistogram("TrustedWebActivity.QualityEnforcementViolation",
type, QualityEnforcementViolationType.MAX_VALUE + 1);
if (crashed) {
RecordHistogram.recordEnumeratedHistogram(
"TrustedWebActivity.QualityEnforcementViolation.Crashed", type,
QualityEnforcementViolationType.MAX_VALUE + 1);
}
new UkmRecorder.Bridge().recordEventWithIntegerMetric(tab.getWebContents(),
/* eventName = */ "TrustedWebActivity.QualityEnforcementViolation",
/* metricName = */ "ViolationType",
/* metricValue = */ type);
}
public void recordQualityEnforcementViolationCrashed(
@QualityEnforcementViolationType int type) {
RecordHistogram.recordEnumeratedHistogram(
"TrustedWebActivity.QualityEnforcementViolation.Crashed", type,
QualityEnforcementViolationType.MAX_VALUE + 1);
}
}
......@@ -12997,6 +12997,28 @@ be describing additional metrics about the same event.
</metric>
</event>
<event name="TrustedWebActivity.QualityEnforcementViolation" singular="True">
<owner>eirage@chromium.org</owner>
<owner>peconn@chromium.org</owner>
<summary>
Records when Trusted Web Activity launches or navigates to a site that
violates the quality criteria.
</summary>
<metric name="ViolationType"
enum="TrustedWebActivityQualityEnforcementViolationType">
<summary>
An enum that records the type of the quality criteria.
</summary>
<aggregation>
<history>
<statistics>
<enumeration/>
</statistics>
</history>
</aggregation>
</metric>
</event>
<event name="Unload" singular="True">
<owner>kdillon@chromium.org</owner>
<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