Skip to content

Commit 22ed2f5

Browse files
Dan HarringtonChromium LUCI CQ
authored andcommitted
webfeed: fix feed network UMA
ContentSuggestions.Feed.Network.CompressedResponseSizeKB.* was being reported with the wrong size. ResponseInfo().encoded_data_length is actually the size of the first chunk of the response. Changed to use CompletionStatus().encoded_data_length. (see crbug.com/1246168) Also tweaked the surrounding code to use the local variable 'loader_response_info' rather than call ResponseInfo() multiple times. This should have no effect. Bug: 1247292 Change-Id: I3c5ed55aa42388ab9ce389a912810c1b554b52c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3139303 Auto-Submit: Dan H <[email protected]> Commit-Queue: Dan H <[email protected]> Reviewed-by: Carlos Knippschild <[email protected]> Cr-Commit-Position: refs/heads/main@{#918845}
1 parent abee3c4 commit 22ed2f5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

components/feed/core/v2/feed_network_impl.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ class FeedNetworkImpl::NetworkFetch {
336336
void OnSimpleLoaderComplete(std::unique_ptr<std::string> response) {
337337
const network::mojom::URLResponseHead* loader_response_info =
338338
simple_loader_->ResponseInfo();
339+
absl::optional<network::URLLoaderCompletionStatus> completion_status =
340+
simple_loader_->CompletionStatus();
339341

340342
NetworkResponseInfo response_info;
341343
response_info.status_code = simple_loader_->NetError();
@@ -346,14 +348,14 @@ class FeedNetworkImpl::NetworkFetch {
346348
response_info.was_signed_in = !access_token_.empty();
347349
response_info.loader_start_time_ticks = loader_only_start_ticks_;
348350
response_info.encoded_size_bytes =
349-
loader_response_info ? loader_response_info->encoded_data_length : 0;
351+
completion_status ? completion_status->encoded_data_length : 0;
350352

351353
// If overriding the feed host, try to grab the Bless nonce. This is
352354
// strictly informational, and only displayed in snippets-internals.
353-
if (allow_bless_auth_ && simple_loader_->ResponseInfo()) {
355+
if (allow_bless_auth_ && loader_response_info) {
354356
size_t iter = 0;
355357
std::string value;
356-
while (simple_loader_->ResponseInfo()->headers->EnumerateHeader(
358+
while (loader_response_info->headers->EnumerateHeader(
357359
&iter, "www-authenticate", &value)) {
358360
size_t pos = value.find("nonce=\"");
359361
if (pos != std::string::npos) {
@@ -369,7 +371,7 @@ class FeedNetworkImpl::NetworkFetch {
369371
std::string response_body;
370372
if (response) {
371373
response_info.status_code =
372-
simple_loader_->ResponseInfo()->headers->response_code();
374+
loader_response_info->headers->response_code();
373375
response_info.response_body_bytes = response->size();
374376

375377
response_body = std::move(*response);

0 commit comments

Comments
 (0)