Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: content/browser/service_worker/service_worker_metrics.cc

Issue 2551013003: Introduce ServiceWorker.MainFramePageLoad.CoreTransition and RedirectChainLength UMAs. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_metrics.h" 5 #include "content/browser/service_worker/service_worker_metrics.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 UMA_HISTOGRAM_SPARSE_SLOWLY("ServiceWorker.Storage.PurgeResourceResult", 314 UMA_HISTOGRAM_SPARSE_SLOWLY("ServiceWorker.Storage.PurgeResourceResult",
315 std::abs(net_error)); 315 std::abs(net_error));
316 } 316 }
317 317
318 void ServiceWorkerMetrics::RecordDeleteAndStartOverResult( 318 void ServiceWorkerMetrics::RecordDeleteAndStartOverResult(
319 DeleteAndStartOverResult result) { 319 DeleteAndStartOverResult result) {
320 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Storage.DeleteAndStartOverResult", 320 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Storage.DeleteAndStartOverResult",
321 result, NUM_DELETE_AND_START_OVER_RESULT_TYPES); 321 result, NUM_DELETE_AND_START_OVER_RESULT_TYPES);
322 } 322 }
323 323
324 void ServiceWorkerMetrics::CountControlledPageLoad(Site site, 324 void ServiceWorkerMetrics::CountControlledPageLoad(
325 const GURL& url, 325 Site site,
326 bool is_main_frame_load) { 326 const GURL& url,
327 bool is_main_frame_load,
328 ui::PageTransition page_transition,
329 size_t redirect_chain_length) {
327 DCHECK_NE(site, Site::OTHER); 330 DCHECK_NE(site, Site::OTHER);
328 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.PageLoad", static_cast<int>(site), 331 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.PageLoad", static_cast<int>(site),
329 static_cast<int>(Site::NUM_TYPES)); 332 static_cast<int>(Site::NUM_TYPES));
330 if (is_main_frame_load) { 333 if (is_main_frame_load) {
331 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.MainFramePageLoad", 334 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.MainFramePageLoad",
332 static_cast<int>(site), 335 static_cast<int>(site),
333 static_cast<int>(Site::NUM_TYPES)); 336 static_cast<int>(Site::NUM_TYPES));
334 } 337 }
335
336 if (ShouldExcludeSiteFromHistogram(site)) 338 if (ShouldExcludeSiteFromHistogram(site))
337 return; 339 return;
340
341 if (is_main_frame_load) {
342 UMA_HISTOGRAM_ENUMERATION(
343 "ServiceWorker.MainFramePageLoad.CoreTransition",
344 static_cast<int>(ui::PageTransitionStripQualifier(page_transition)),
345 static_cast<int>(ui::PAGE_TRANSITION_LAST_CORE));
falken 2016/12/06 01:25:14 should be LAST_CORE + 1?
horo 2016/12/06 01:44:51 Done.
346 // The max number of http redirects is 20. So the max number of the chain
347 // length is 21.
falken 2016/12/06 01:25:14 Could we make kMaxRedirects public and refer to it
horo 2016/12/06 01:44:51 Done.
348 UMA_HISTOGRAM_EXACT_LINEAR(
349 "ServiceWorker.MainFramePageLoad.RedirectChainLength",
350 redirect_chain_length, 21);
351 }
338 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 352 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
339 base::Bind(&RecordURLMetricOnUI, url)); 353 base::Bind(&RecordURLMetricOnUI, url));
340 } 354 }
341 355
342 void ServiceWorkerMetrics::RecordStartWorkerStatus( 356 void ServiceWorkerMetrics::RecordStartWorkerStatus(
343 ServiceWorkerStatusCode status, 357 ServiceWorkerStatusCode status,
344 EventType purpose, 358 EventType purpose,
345 bool is_installed) { 359 bool is_installed) {
346 if (!is_installed) { 360 if (!is_installed) {
347 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartNewWorker.Status", status, 361 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartNewWorker.Status", status,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } else if (failure_count == 2) { 754 } else if (failure_count == 2) {
741 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_2", 755 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_2",
742 status, SERVICE_WORKER_ERROR_MAX_VALUE); 756 status, SERVICE_WORKER_ERROR_MAX_VALUE);
743 } else if (failure_count == 3) { 757 } else if (failure_count == 3) {
744 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_3", 758 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.StartWorker.AfterFailureStreak_3",
745 status, SERVICE_WORKER_ERROR_MAX_VALUE); 759 status, SERVICE_WORKER_ERROR_MAX_VALUE);
746 } 760 }
747 } 761 }
748 762
749 } // namespace content 763 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698