| Index: components/ntp_snippets/content_suggestions_metrics.cc
|
| diff --git a/components/ntp_snippets/content_suggestions_metrics.cc b/components/ntp_snippets/content_suggestions_metrics.cc
|
| index 4f61eed1fa9af77c9dbb0f6ea8386caaae14bbf1..9526fc4078a9f5177164aebe32f3e2faa2311ac5 100644
|
| --- a/components/ntp_snippets/content_suggestions_metrics.cc
|
| +++ b/components/ntp_snippets/content_suggestions_metrics.cc
|
| @@ -4,10 +4,12 @@
|
|
|
| #include "components/ntp_snippets/content_suggestions_metrics.h"
|
|
|
| +#include <cmath>
|
| #include <string>
|
| #include <type_traits>
|
|
|
| #include "base/metrics/histogram.h"
|
| +#include "base/metrics/histogram_functions.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/metrics/user_metrics.h"
|
| #include "base/strings/stringprintf.h"
|
| @@ -25,18 +27,19 @@ const char kHistogramCountOnNtpOpened[] =
|
| "NewTabPage.ContentSuggestions.CountOnNtpOpened";
|
| const char kHistogramShown[] = "NewTabPage.ContentSuggestions.Shown";
|
| const char kHistogramShownAge[] = "NewTabPage.ContentSuggestions.ShownAge";
|
| -const char kHistogramShownScore[] = "NewTabPage.ContentSuggestions.ShownScore";
|
| +const char kHistogramShownScore[] =
|
| + "NewTabPage.ContentSuggestions.ShownScoreNormalized";
|
| const char kHistogramOpened[] = "NewTabPage.ContentSuggestions.Opened";
|
| const char kHistogramOpenedAge[] = "NewTabPage.ContentSuggestions.OpenedAge";
|
| const char kHistogramOpenedScore[] =
|
| - "NewTabPage.ContentSuggestions.OpenedScore";
|
| + "NewTabPage.ContentSuggestions.OpenedScoreNormalized";
|
| const char kHistogramOpenDisposition[] =
|
| "NewTabPage.ContentSuggestions.OpenDisposition";
|
| const char kHistogramMenuOpened[] = "NewTabPage.ContentSuggestions.MenuOpened";
|
| const char kHistogramMenuOpenedAge[] =
|
| "NewTabPage.ContentSuggestions.MenuOpenedAge";
|
| const char kHistogramMenuOpenedScore[] =
|
| - "NewTabPage.ContentSuggestions.MenuOpenedScore";
|
| + "NewTabPage.ContentSuggestions.MenuOpenedScoreNormalized";
|
| const char kHistogramDismissedUnvisited[] =
|
| "NewTabPage.ContentSuggestions.DismissedUnvisited";
|
| const char kHistogramDismissedVisited[] =
|
| @@ -146,16 +149,6 @@ void UmaHistogramEnumeration(const std::string& name,
|
| ->Add(value);
|
| }
|
|
|
| -// This corresponds to UMA_HISTOGRAM_LONG_TIMES for use with dynamic histogram
|
| -// names.
|
| -void UmaHistogramLongTimes(const std::string& name,
|
| - const base::TimeDelta& value) {
|
| - base::Histogram::FactoryTimeGet(
|
| - name, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromHours(1),
|
| - 50, base::HistogramBase::kUmaTargetedHistogramFlag)
|
| - ->AddTime(value);
|
| -}
|
| -
|
| // This corresponds to UMA_HISTOGRAM_CUSTOM_TIMES (with min/max appropriate
|
| // for the age of suggestions) for use with dynamic histogram names.
|
| void UmaHistogramAge(const std::string& name, const base::TimeDelta& value) {
|
| @@ -168,9 +161,12 @@ void UmaHistogramAge(const std::string& name, const base::TimeDelta& value) {
|
| // This corresponds to UMA_HISTOGRAM_CUSTOM_COUNTS (with min/max appropriate
|
| // for the score of suggestions) for use with dynamic histogram names.
|
| void UmaHistogramScore(const std::string& name, float value) {
|
| - base::Histogram::FactoryGet(name, 1, 100000, 50,
|
| - base::HistogramBase::kUmaTargetedHistogramFlag)
|
| - ->Add(value);
|
| + // Scores are typically reported in a range of (0,1]. As UMA does not support
|
| + // floats, we put them on a discrete scale of [1,10]. We keep the extra bucket
|
| + // 11 for unexpected over-flows as we want to distinguish them from scores
|
| + // close to 1. For instance, the discrete value 1 represents score values
|
| + // within (0.0, 0.1].
|
| + base::UmaHistogramExactLinear(name, ceil(value * 10), 11);
|
| }
|
|
|
| void LogCategoryHistogramEnumeration(const char* base_name,
|
|
|