Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "components/autofill/core/browser/autofill_type.h" | 10 #include "components/autofill/core/browser/autofill_type.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 default: | 151 default: |
| 152 NOTREACHED(); | 152 NOTREACHED(); |
| 153 group = AMBIGUOUS; | 153 group = AMBIGUOUS; |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Interpolate the |metric| with the |group|, so that all metrics for a given | 156 // Interpolate the |metric| with the |group|, so that all metrics for a given |
| 157 // |group| are adjacent. | 157 // |group| are adjacent. |
| 158 return (group * num_possible_metrics) + metric; | 158 return (group * num_possible_metrics) + metric; |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Returns the histogram prefix to use for reporting metrics for |dialog_type|. | |
| 162 std::string GetPrefixForDialogType(autofill::DialogType dialog_type) { | |
| 163 switch (dialog_type) { | |
| 164 case autofill::DIALOG_TYPE_AUTOCHECKOUT: | |
| 165 return "Autocheckout"; | |
| 166 | |
| 167 case autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE: | |
| 168 return "RequestAutocomplete"; | |
| 169 } | |
| 170 | |
| 171 NOTREACHED(); | |
| 172 return "UnknownDialogType"; | |
| 173 } | |
| 174 | |
| 175 std::string WalletApiMetricToString( | 161 std::string WalletApiMetricToString( |
| 176 AutofillMetrics::WalletApiCallMetric metric) { | 162 AutofillMetrics::WalletApiCallMetric metric) { |
| 177 switch (metric) { | 163 switch (metric) { |
| 178 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS: | 164 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS: |
| 179 return "AcceptLegalDocuments"; | 165 return "AcceptLegalDocuments"; |
| 180 case AutofillMetrics::AUTHENTICATE_INSTRUMENT: | 166 case AutofillMetrics::AUTHENTICATE_INSTRUMENT: |
| 181 return "AuthenticateInstrument"; | 167 return "AuthenticateInstrument"; |
| 182 case AutofillMetrics::GET_FULL_WALLET: | 168 case AutofillMetrics::GET_FULL_WALLET: |
| 183 return "GetFullWallet"; | 169 return "GetFullWallet"; |
| 184 case AutofillMetrics::GET_WALLET_ITEMS: | 170 case AutofillMetrics::GET_WALLET_ITEMS: |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 } | 310 } |
| 325 | 311 |
| 326 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const { | 312 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const { |
| 327 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 313 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
| 328 | 314 |
| 329 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar", metric, | 315 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar", metric, |
| 330 NUM_INFO_BAR_METRICS); | 316 NUM_INFO_BAR_METRICS); |
| 331 } | 317 } |
| 332 | 318 |
| 333 void AutofillMetrics::LogDialogDismissalState( | 319 void AutofillMetrics::LogDialogDismissalState( |
| 334 autofill::DialogType dialog_type, | |
| 335 DialogDismissalState state) const { | 320 DialogDismissalState state) const { |
| 336 std::string name = GetPrefixForDialogType(dialog_type) + ".DismissalState"; | 321 std::string name = "RequestAutocomplete.DismissalState"; |
| 337 LogUMAHistogramEnumeration(name, state, NUM_DIALOG_DISMISSAL_STATES); | 322 LogUMAHistogramEnumeration(name, state, NUM_DIALOG_DISMISSAL_STATES); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:31
Done.
| |
| 338 } | 323 } |
| 339 | 324 |
| 340 void AutofillMetrics::LogDialogInitialUserState( | 325 void AutofillMetrics::LogDialogInitialUserState( |
| 341 autofill::DialogType dialog_type, | |
| 342 DialogInitialUserStateMetric user_type) const { | 326 DialogInitialUserStateMetric user_type) const { |
| 343 std::string name = GetPrefixForDialogType(dialog_type) + ".InitialUserState"; | 327 std::string name = "RequestAutocomplete.InitialUserState"; |
| 344 LogUMAHistogramEnumeration( | 328 LogUMAHistogramEnumeration( |
| 345 name, user_type, NUM_DIALOG_INITIAL_USER_STATE_METRICS); | 329 name, user_type, NUM_DIALOG_INITIAL_USER_STATE_METRICS); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:31
Done.
| |
| 346 } | 330 } |
| 347 | 331 |
| 348 void AutofillMetrics::LogDialogLatencyToShow( | 332 void AutofillMetrics::LogDialogLatencyToShow( |
| 349 autofill::DialogType dialog_type, | |
| 350 const base::TimeDelta& duration) const { | 333 const base::TimeDelta& duration) const { |
| 351 std::string name = | 334 std::string name = "RequestAutocomplete.UiLatencyToShow"; |
| 352 GetPrefixForDialogType(dialog_type) + ".UiLatencyToShow"; | |
| 353 LogUMAHistogramTimes(name, duration); | 335 LogUMAHistogramTimes(name, duration); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:31
Done.
| |
| 354 } | 336 } |
| 355 | 337 |
| 356 void AutofillMetrics::LogDialogPopupEvent(autofill::DialogType dialog_type, | 338 void AutofillMetrics::LogDialogPopupEvent(DialogPopupEvent event) const { |
| 357 DialogPopupEvent event) const { | 339 std::string name = "RequestAutocomplete.PopupInDialog"; |
| 358 std::string name = GetPrefixForDialogType(dialog_type) + ".PopupInDialog"; | |
| 359 LogUMAHistogramEnumeration(name, event, NUM_DIALOG_POPUP_EVENTS); | 340 LogUMAHistogramEnumeration(name, event, NUM_DIALOG_POPUP_EVENTS); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:31
Done.
| |
| 360 } | 341 } |
| 361 | 342 |
| 362 void AutofillMetrics::LogDialogSecurityMetric( | 343 void AutofillMetrics::LogDialogSecurityMetric( |
| 363 autofill::DialogType dialog_type, | |
| 364 DialogSecurityMetric metric) const { | 344 DialogSecurityMetric metric) const { |
| 365 std::string name = GetPrefixForDialogType(dialog_type) + ".Security"; | 345 std::string name = "RequestAutocomplete.Security"; |
| 366 LogUMAHistogramEnumeration(name, metric, NUM_DIALOG_SECURITY_METRICS); | 346 LogUMAHistogramEnumeration(name, metric, NUM_DIALOG_SECURITY_METRICS); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:31
Done.
| |
| 367 } | 347 } |
| 368 | 348 |
| 369 void AutofillMetrics::LogDialogUiDuration( | 349 void AutofillMetrics::LogDialogUiDuration( |
| 370 const base::TimeDelta& duration, | 350 const base::TimeDelta& duration, |
| 371 autofill::DialogType dialog_type, | |
| 372 DialogDismissalAction dismissal_action) const { | 351 DialogDismissalAction dismissal_action) const { |
| 373 std::string prefix = GetPrefixForDialogType(dialog_type); | |
| 374 | |
| 375 std::string suffix; | 352 std::string suffix; |
| 376 switch (dismissal_action) { | 353 switch (dismissal_action) { |
| 377 case DIALOG_ACCEPTED: | 354 case DIALOG_ACCEPTED: |
| 378 suffix = "Submit"; | 355 suffix = "Submit"; |
| 379 break; | 356 break; |
| 380 | 357 |
| 381 case DIALOG_CANCELED: | 358 case DIALOG_CANCELED: |
| 382 suffix = "Cancel"; | 359 suffix = "Cancel"; |
| 383 break; | 360 break; |
| 384 } | 361 } |
| 385 | 362 |
| 386 LogUMAHistogramLongTimes(prefix + ".UiDuration", duration); | 363 LogUMAHistogramLongTimes("RequestAutocomplete.UiDuration", duration); |
| 387 LogUMAHistogramLongTimes(prefix + ".UiDuration." + suffix, duration); | 364 LogUMAHistogramLongTimes("RequestAutocomplete.UiDuration." + suffix, |
| 365 duration); | |
| 388 } | 366 } |
| 389 | 367 |
| 390 void AutofillMetrics::LogDialogUiEvent(autofill::DialogType dialog_type, | 368 void AutofillMetrics::LogDialogUiEvent(DialogUiEvent event) const { |
| 391 DialogUiEvent event) const { | 369 std::string name = "RequestAutocomplete.UiEvents"; |
| 392 std::string name = GetPrefixForDialogType(dialog_type) + ".UiEvents"; | |
| 393 LogUMAHistogramEnumeration(name, event, NUM_DIALOG_UI_EVENTS); | 370 LogUMAHistogramEnumeration(name, event, NUM_DIALOG_UI_EVENTS); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:31
Done.
| |
| 394 } | 371 } |
| 395 | 372 |
| 396 void AutofillMetrics::LogWalletErrorMetric(autofill::DialogType dialog_type, | 373 void AutofillMetrics::LogWalletErrorMetric(WalletErrorMetric metric) const { |
| 397 WalletErrorMetric metric) const { | 374 std::string name = "RequestAutocomplete.WalletErrors"; |
| 398 std::string name = GetPrefixForDialogType(dialog_type) + ".WalletErrors"; | |
| 399 LogUMAHistogramEnumeration(name, metric, NUM_WALLET_ERROR_METRICS); | 375 LogUMAHistogramEnumeration(name, metric, NUM_WALLET_ERROR_METRICS); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:32
Done.
| |
| 400 } | 376 } |
| 401 | 377 |
| 402 void AutofillMetrics::LogWalletApiCallDuration( | 378 void AutofillMetrics::LogWalletApiCallDuration( |
| 403 WalletApiCallMetric metric, | 379 WalletApiCallMetric metric, |
| 404 const base::TimeDelta& duration) const { | 380 const base::TimeDelta& duration) const { |
| 405 LogUMAHistogramTimes("Wallet.ApiCallDuration." + | 381 LogUMAHistogramTimes("Wallet.ApiCallDuration." + |
| 406 WalletApiMetricToString(metric), duration); | 382 WalletApiMetricToString(metric), duration); |
| 407 } | 383 } |
| 408 | 384 |
| 409 void AutofillMetrics::LogWalletRequiredActionMetric( | 385 void AutofillMetrics::LogWalletRequiredActionMetric( |
| 410 autofill::DialogType dialog_type, | |
| 411 WalletRequiredActionMetric required_action) const { | 386 WalletRequiredActionMetric required_action) const { |
| 412 std::string name = | 387 std::string name = "RequestAutocomplete.WalletRequiredActions"; |
| 413 GetPrefixForDialogType(dialog_type) + ".WalletRequiredActions"; | |
| 414 LogUMAHistogramEnumeration( | 388 LogUMAHistogramEnumeration( |
| 415 name, required_action, NUM_WALLET_REQUIRED_ACTIONS); | 389 name, required_action, NUM_WALLET_REQUIRED_ACTIONS); |
|
Ilya Sherman
2013/09/03 20:57:05
nit: Please update this to use the regular UMA_HIS
Raman Kakilate
2013/09/03 21:50:32
Done.
| |
| 416 } | 390 } |
| 417 | 391 |
| 418 void AutofillMetrics::LogDeveloperEngagementMetric( | 392 void AutofillMetrics::LogDeveloperEngagementMetric( |
| 419 DeveloperEngagementMetric metric) const { | 393 DeveloperEngagementMetric metric) const { |
| 420 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS); | 394 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS); |
| 421 | 395 |
| 422 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric, | 396 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric, |
| 423 NUM_DEVELOPER_ENGAGEMENT_METRICS); | 397 NUM_DEVELOPER_ENGAGEMENT_METRICS); |
| 424 } | 398 } |
| 425 | 399 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 const std::string& experiment_id) const { | 507 const std::string& experiment_id) const { |
| 534 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); | 508 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); |
| 535 } | 509 } |
| 536 | 510 |
| 537 void AutofillMetrics::LogServerExperimentIdForUpload( | 511 void AutofillMetrics::LogServerExperimentIdForUpload( |
| 538 const std::string& experiment_id) const { | 512 const std::string& experiment_id) const { |
| 539 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); | 513 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); |
| 540 } | 514 } |
| 541 | 515 |
| 542 } // namespace autofill | 516 } // namespace autofill |
| OLD | NEW |