Commit 550c8091 authored by sczs's avatar sczs Committed by Chromium LUCI CQ

[ios] Creates Feed network latency recording methods.

-Adds methods to record the un/succsessful network duration of articles fetch,
more articles fetch and actions upload.
-Creates a new Histogram for un/succsessful actions upload

Bug: 1159119
Change-Id: Id83b824be73d7340876a968016426187eebd1001
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593743
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarDan H <harringtond@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838181}
parent dd650a13
...@@ -88,8 +88,23 @@ ...@@ -88,8 +88,23 @@
- (void)recordNoticeCardShown:(BOOL)shown; - (void)recordNoticeCardShown:(BOOL)shown;
// Records the |durationInSeconds| it took to Discover feed to Fetch articles. // Records the |durationInSeconds| it took to Discover feed to Fetch articles.
// |success| is YES if operation was successful.
- (void)recordFeedArticlesFetchDurationInSeconds: - (void)recordFeedArticlesFetchDurationInSeconds:
(NSTimeInterval)durationInSeconds; (NSTimeInterval)durationInSeconds
success:(BOOL)success;
// Records the |durationInSeconds| it took to Discover feed to Fetch more
// articles (e.g. New "infinite feed" articles). |success| is YES if operation
// was successful.
- (void)recordFeedMoreArticlesFetchDurationInSeconds:
(NSTimeInterval)durationInSeconds
success:(BOOL)success;
// Records the |durationInSeconds| it took to Discover feed to upload actions.
// |success| is YES if operation was successful.
- (void)recordFeedUploadActionsDurationInSeconds:
(NSTimeInterval)durationInSeconds
success:(BOOL)success;
@end @end
......
...@@ -112,8 +112,39 @@ const char kDiscoverFeedEngagementTypeHistogram[] = ...@@ -112,8 +112,39 @@ const char kDiscoverFeedEngagementTypeHistogram[] =
const char kDiscoverFeedNoticeCardFulfilled[] = const char kDiscoverFeedNoticeCardFulfilled[] =
"ContentSuggestions.Feed.NoticeCardFulfilled2"; "ContentSuggestions.Feed.NoticeCardFulfilled2";
// Histogram name to measure the time it tood the Feed to fetch articles. // Histogram name to measure the time it took the Feed to fetch articles
const char kDiscoverFeedArticlesFetchNetworkDuration[] = // successfully.
const char kDiscoverFeedArticlesFetchNetworkDurationSuccess[] =
"ContentSuggestions.Feed.Network.Duration.ArticlesFetchSuccess";
// Histogram name to measure the time it took the Feed to fetch articles
// unsuccessfully.
const char kDiscoverFeedArticlesFetchNetworkDurationFailure[] =
"ContentSuggestions.Feed.Network.Duration.ArticlesFetchFailure";
// Histogram name to measure the time it took the Feed to fetch more articles
// successfully.
const char kDiscoverFeedMoreArticlesFetchNetworkDurationSuccess[] =
"ContentSuggestions.Feed.Network.Duration.MoreArticlesFetchSuccess";
// Histogram name to measure the time it took the Feed to fetch more articles
// unsuccessfully.
const char kDiscoverFeedMoreArticlesFetchNetworkDurationFailure[] =
"ContentSuggestions.Feed.Network.Duration.MoreArticlesFetchFailure";
// Histogram name to measure the time it took the Feed to upload actions
// successfully.
const char kDiscoverFeedUploadActionsNetworkDurationSuccess[] =
"ContentSuggestions.Feed.Network.Duration.ActionUploadSuccess";
// Histogram name to measure the time it took the Feed to upload actions
// unsuccessfully.
const char kDiscoverFeedUploadActionsNetworkDurationFailure[] =
"ContentSuggestions.Feed.Network.Duration.ActionUploadFailure";
// Histogram name to measure the time it took the Feed to perform a network
// operation.
const char kDiscoverFeedNetworkDuration[] =
"ContentSuggestions.Feed.Network.Duration"; "ContentSuggestions.Feed.Network.Duration";
// Minimum scrolling amount to record a FeedEngagementType::kFeedEngaged due to // Minimum scrolling amount to record a FeedEngagementType::kFeedEngaged due to
...@@ -294,9 +325,44 @@ const int kMinutesBetweenSessions = 5; ...@@ -294,9 +325,44 @@ const int kMinutesBetweenSessions = 5;
} }
- (void)recordFeedArticlesFetchDurationInSeconds: - (void)recordFeedArticlesFetchDurationInSeconds:
(NSTimeInterval)durationInSeconds { (NSTimeInterval)durationInSeconds
UMA_HISTOGRAM_MEDIUM_TIMES(kDiscoverFeedArticlesFetchNetworkDuration, success:(BOOL)success {
base::TimeDelta::FromSeconds(durationInSeconds)); if (success) {
UMA_HISTOGRAM_MEDIUM_TIMES(kDiscoverFeedArticlesFetchNetworkDurationSuccess,
base::TimeDelta::FromSeconds(durationInSeconds));
} else {
UMA_HISTOGRAM_MEDIUM_TIMES(kDiscoverFeedArticlesFetchNetworkDurationFailure,
base::TimeDelta::FromSeconds(durationInSeconds));
}
[self recordNetworkRequestDurationInSeconds:durationInSeconds];
}
- (void)recordFeedMoreArticlesFetchDurationInSeconds:
(NSTimeInterval)durationInSeconds
success:(BOOL)success {
if (success) {
UMA_HISTOGRAM_MEDIUM_TIMES(
kDiscoverFeedMoreArticlesFetchNetworkDurationSuccess,
base::TimeDelta::FromSeconds(durationInSeconds));
} else {
UMA_HISTOGRAM_MEDIUM_TIMES(
kDiscoverFeedMoreArticlesFetchNetworkDurationFailure,
base::TimeDelta::FromSeconds(durationInSeconds));
}
[self recordNetworkRequestDurationInSeconds:durationInSeconds];
}
- (void)recordFeedUploadActionsDurationInSeconds:
(NSTimeInterval)durationInSeconds
success:(BOOL)success {
if (success) {
UMA_HISTOGRAM_MEDIUM_TIMES(kDiscoverFeedUploadActionsNetworkDurationSuccess,
base::TimeDelta::FromSeconds(durationInSeconds));
} else {
UMA_HISTOGRAM_MEDIUM_TIMES(kDiscoverFeedUploadActionsNetworkDurationFailure,
base::TimeDelta::FromSeconds(durationInSeconds));
}
[self recordNetworkRequestDurationInSeconds:durationInSeconds];
} }
#pragma mark - Private #pragma mark - Private
...@@ -362,4 +428,12 @@ const int kMinutesBetweenSessions = 5; ...@@ -362,4 +428,12 @@ const int kMinutesBetweenSessions = 5;
self.scrolledReported = NO; self.scrolledReported = NO;
} }
// Records the |durationInSeconds| it took to Discover feed to perform any
// network operation.
- (void)recordNetworkRequestDurationInSeconds:
(NSTimeInterval)durationInSeconds {
UMA_HISTOGRAM_MEDIUM_TIMES(kDiscoverFeedNetworkDuration,
base::TimeDelta::FromSeconds(durationInSeconds));
}
@end @end
...@@ -879,6 +879,22 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -879,6 +879,22 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="ContentSuggestions.Feed.Network.Duration.{NetworkEvent}"
units="ms" expires_after="M90">
<owner>sczs@chromium.org</owner>
<owner>harringtond@chromium.org</owner>
<owner>feed@chromium.org</owner>
<summary>The amount of time a {NetworkEvent} network event took.</summary>
<token key="NetworkEvent">
<variant name="ActionUploadFailure"/>
<variant name="ActionUploadSuccess"/>
<variant name="ArticlesFetchFailure"/>
<variant name="ArticlesFetchSuccess"/>
<variant name="MoreArticlesFetchFailure"/>
<variant name="MoreArticlesFetchSuccess"/>
</token>
</histogram>
<histogram name="ContentSuggestions.Feed.Network.RequestSizeKB.Compressed" <histogram name="ContentSuggestions.Feed.Network.RequestSizeKB.Compressed"
units="KB" expires_after="M90"> units="KB" expires_after="M90">
<owner>carlosk@chromium.org</owner> <owner>carlosk@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