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

Unified Diff: components/ntp_snippets/content_suggestions_metrics.cc

Issue 2619203007: Log suggestion scores in 10 discrete buckets. (Closed)
Patch Set: Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
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..c8634d7cf9ffd147aec3884f37425f6dcffc3e12 100644
--- a/components/ntp_snippets/content_suggestions_metrics.cc
+++ b/components/ntp_snippets/content_suggestions_metrics.cc
@@ -4,6 +4,7 @@
#include "components/ntp_snippets/content_suggestions_metrics.h"
+#include <cmath>
#include <string>
#include <type_traits>
@@ -168,9 +169,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,
+ // 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
jkrcal 2017/01/10 19:31:47 nit: Could you expand the comment, e.g. "For insta
tschumann 2017/01/12 12:25:31 Done.
+ // for unexpected over-flows.
+ base::Histogram::FactoryGet(name, 1, 11, 12,
jkrcal 2017/01/10 19:31:47 I think you should use LinearHistogram, instead. H
tschumann 2017/01/12 12:25:31 Apparently, we need to create a new histogram for
jkrcal 2017/01/12 15:13:10 Acknowledged.
base::HistogramBase::kUmaTargetedHistogramFlag)
- ->Add(value);
+ ->Add(ceil(value*10));
}
void LogCategoryHistogramEnumeration(const char* base_name,

Powered by Google App Engine
This is Rietveld 408576698