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

Unified Diff: base/metrics/histogram_macros.h

Issue 2831543002: [UMA] Expand the comment for UMA_HISTOGRAM_SPARSE_SLOWLY (Closed)
Patch Set: Ilya's comments Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_macros.h
diff --git a/base/metrics/histogram_macros.h b/base/metrics/histogram_macros.h
index d39972a8a12abde3b9a3159fe76c76f456de5580..504cd3fcffac4657a16b1ce61266258b139dd004 100644
--- a/base/metrics/histogram_macros.h
+++ b/base/metrics/histogram_macros.h
@@ -247,7 +247,17 @@
//
// UMA_HISTOGRAM_SPARSE_SLOWLY is good for sparsely distributed and/or
// infrequently recorded values since the implementation is slower
-// and takes more memory.
+// and takes more memory. For sparse data, sparse histograms have the advantage
+// of using less memory client-side, because they allocate buckets on demand
+// rather than preallocating. However, server-side, we still need to load all
+// buckets, across all users, at once.
+
+// Thus, please avoid exploding such histograms, i.e. uploading many many
+// distinct values to the server (across all users). Concretely, keep the number
+// of distinct values <= 100 at best, definitely <= 1000. If you have no
+// guarantees on the range of your data, use capping, e.g.:
+// UMA_HISTOGRAM_SPARSE_SLOWLY("MyHistogram",
+// std::max(0, std::min(200, value)));
//
// For instance, Sqlite.Version.* are sparse because for any given database,
// there's going to be exactly one version logged.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698