bug 1440673 - Allow scalar keys to be an extra 2 chars long r=Dexter

This allows us to store Telemetry Event category (30), method (20),
object (20), and two delimiters (2) in a single key, like so:

oohwowlookthiscategoryissolong#thismethodislongtooo#thisobjectisnoslouch

MozReview-Commit-ID: BkoU1VAXFF9

--HG--
extra : rebase_source : b172e8dd8ee925f05545a944e340fb5a43c296b1
This commit is contained in:
Chris H-C 2018-03-27 16:15:27 -04:00
Родитель 141799e3a7
Коммит bfaa371960
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -88,7 +88,7 @@ namespace TelemetryIPCAccumulator = mozilla::TelemetryIPCAccumulator;
namespace {
const uint32_t kMaximumNumberOfKeys = 100;
const uint32_t kMaximumKeyStringLength = 70;
const uint32_t kMaximumKeyStringLength = 72;
const uint32_t kMaximumStringValueLength = 50;
// The category and scalar name maximum lengths are used by the dynamic
// scalar registration function and must match the constants used by
@ -922,7 +922,7 @@ internal_LogScalarError(const nsACString& aScalarName, ScalarResult aSr)
errorMessage.AppendLiteral(u" - The key must not be empty.");
break;
case ScalarResult::KeyTooLong:
errorMessage.AppendLiteral(u" - The key length must be limited to 70 characters.");
errorMessage.AppendLiteral(u" - The key length must be limited to 72 characters.");
break;
case ScalarResult::TooManyKeys:
errorMessage.AppendLiteral(u" - Keyed scalars cannot have more than 100 keys.");

Просмотреть файл

@ -174,7 +174,7 @@ to set a longer string will result in an error and no string being set.
Keyed Scalars
-------------
Keyed scalars are collections of one of the available scalar types, indexed by a string key that can contain UTF8 characters and cannot be longer than 70 characters. Keyed scalars can contain up to 100 keys. This scalar type is for example useful when you want to break down certain counts by a name, like how often searches happen with which search engine.
Keyed scalars are collections of one of the available scalar types, indexed by a string key that can contain UTF8 characters and cannot be longer than 72 characters. Keyed scalars can contain up to 100 keys. This scalar type is for example useful when you want to break down certain counts by a name, like how often searches happen with which search engine.
Keyed scalars should only be used if the set of keys are not known beforehand. If the keys are from a known set of strings, other options are preferred if suitable, like categorical histograms or splitting measurements up into separate scalars.