Closed Bug 1281214 Opened 9 years ago Closed 9 years ago

Implement the boolean scalar type

Categories

(Toolkit :: Telemetry, defect, P1)

defect
Points:
2

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: Dexter, Assigned: Dexter)

References

(Blocks 1 open bug)

Details

(Whiteboard: [measurement:client])

Attachments

(2 files, 2 obsolete files)

After the core implementation lands in bug 1276195, to cover all the basic scalar use cases, we should implement the boolean scalar type [0]. The scalar boolean will store a boolean value (useful for e.g. feature checks) and will not have a default value, meaning that it won't be sent unless it's set to some value. [0] - https://docs.google.com/document/d/13mcY17RzpE3BsB4CgR6DidytWzl4tMpAEmrvf8fOSJ8/
Blocks: 1275517
Priority: -- → P3
Whiteboard: [measurement:client]
Priority: P3 → P1
Attached patch bug1281214.patch (obsolete) — Splinter Review
Assignee: nobody → alessio.placitelli
Status: NEW → ASSIGNED
Attached patch bug1281214.patch (obsolete) — Splinter Review
Attachment #8769698 - Attachment is obsolete: true
Attachment #8769700 - Flags: review?(gfritzsche)
Points: --- → 2
Comment on attachment 8769700 [details] [diff] [review] bug1281214.patch Review of attachment 8769700 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/telemetry/TelemetryScalar.cpp @@ +87,5 @@ > UnsignedInvalidValue, > UnsignedNegativeValue, > UnsignedTruncatedValue, > + // Boolean Scalar Errors > + BooleanInvalidType, Do we actually need to treat this different from `StringInvalidType`? If not lets just use a general `InvalidType` code. @@ +434,5 @@ > + // Check that we got the correct data type. > + uint16_t type; > + aValue->GetDataType(&type); > + if (type != nsIDataType::VTYPE_BOOL) { > + return ScalarResult::BooleanInvalidType; This prevents from doing calls like `scalarSet("foo", 1)`. We should support number types that convert to boolean too. ::: toolkit/components/telemetry/tests/unit/test_TelemetryScalars.js @@ +216,5 @@ > + /NS_ERROR_NOT_AVAILABLE/, > + "Using an unsupported operation must throw."); > + Assert.throws(() => Telemetry.scalarSet(BOOLEAN_SCALAR, 1), > + /NS_ERROR_ILLEGAL_VALUE/, > + "The boolean scalar must throw if we're not setting a boolean."); I think that should be supported.
Attachment #8769700 - Flags: review?(gfritzsche)
Attached patch bug1281214.patchSplinter Review
Added support for implicitly converting numeric arguments to boolean for boolean scalars.
Attachment #8769700 - Attachment is obsolete: true
Attachment #8769726 - Flags: review?(gfritzsche)
Comment on attachment 8769726 [details] [diff] [review] bug1281214.patch Review of attachment 8769726 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. This needs a documentation update, but we can take that to a separate patch.
Attachment #8769726 - Flags: review?(gfritzsche) → review+
Update the docs.
Attachment #8770126 - Flags: review?(gfritzsche)
Attachment #8770126 - Flags: review?(gfritzsche) → review+
Pushed by alessio.placitelli@gmail.com: https://hg.mozilla.org/integration/fx-team/rev/abf809943e7c Implement the boolean scalar type. r=gfritzsche https://hg.mozilla.org/integration/fx-team/rev/e0d821942d29 Update the documentation. r=gfritzsche
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
(In reply to Alessio Placitelli [:Dexter] from comment #0) > The scalar boolean will store a boolean value (useful for e.g. feature > checks) and will not have a default value, meaning that it won't be sent > unless it's set to some value. Does this mean that in order to replicate the semantics of the "flag" type in Historgrams.json (the build system doesn't want me to add more of those), I have to initialize the boolean to false at startup to collect the sessions where the situation that warrants setting the flag to true doesn't occur? If so, where should I do it so that each new content process doesn't reset the flag to false? With e10s-multi, what are the semantics for booleans collected in the content process? Is the value "true" in any content process during the lifetime of the chrome process set the boolean to true?
Flags: needinfo?(alessio.placitelli)
(In reply to Henri Sivonen (:hsivonen) from comment #11) > (In reply to Alessio Placitelli [:Dexter] from comment #0) > > The scalar boolean will store a boolean value (useful for e.g. feature > > checks) and will not have a default value, meaning that it won't be sent > > unless it's set to some value. > > Does this mean that in order to replicate the semantics of the "flag" type > in Historgrams.json (the build system doesn't want me to add more of those), > I have to initialize the boolean to false at startup to collect the sessions > where the situation that warrants setting the flag to true doesn't occur? If > so, where should I do it so that each new content process doesn't reset the > flag to false? If you're just interested in making sure some feature is being used, you would just need to set the scalar to "true" when that happens. The scalar, as you mentioned, won't be sent unless it has some set value (either "true" or "false"). As discussed over IRC, there's a caveat there: > without setting the "false" value, is it still possible to see the proportion of submissions where it was set to true vs. all submissions (incl. those with neither true nor false)? @frank, do you know the answer to the question above? > With e10s-multi, what are the semantics for booleans collected in the > content process? There's some documentation here: https://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/collection/scalars.html#multiple-processes-caveats > Is the value "true" in any content process during the lifetime of the chrome process set the boolean to true? Yes, it sets the "content" scalar to "true" if any content process sets it to true. If you are recording the same scalar in both the "parent" and the "content" processes, and you set the scalar to "true" only in the content process, only the "content" version of the scalar will be populated with the value, not the "parent" version. Here's the relevant code that updates the scalar with data coming from the other processes, if curious: http://searchfox.org/mozilla-central/rev/944f87c575e8a0bcefc1ed8efff10b34cf7a5169/toolkit/components/telemetry/TelemetryScalar.cpp#2205 Bonus example code: http://searchfox.org/mozilla-central/source/toolkit/components/telemetry/tests/unit/test_ChildScalars.js
Flags: needinfo?(alessio.placitelli) → needinfo?(fbertsch)
> > without setting the "false" value, is it still possible to see the proportion of submissions where it was set to true vs. all submissions (incl. those with neither true nor false)? No, it is not, at least not easily. Definitely TMO will not have that information available.
Flags: needinfo?(fbertsch)
In particular that is almost never a good question to ask. Subsessions are of greatly variable length. Usually the right question is how many *users* over a given time period are affected, or lacking that normalizing your data by usage hour. But if that is in fact still the question you want to ask, it's possible to count the total number of subsesssions and the total number of subsessions with a value and present that as a ratio. I believe that's already possible using telemetry.js v2.
(In reply to Benjamin Smedberg [:bsmedberg] from comment #14) > In particular that is almost never a good question to ask. Subsessions are > of greatly variable length. It's good enough to figure out if a feature affects a large proportion of sessions or if the feature is almost entirely unused. (I.e. it's not about 50% vs. 10% but about within 0% rounding error vs. something else.) > Usually the right question is how many *users* > over a given time period are affected, or lacking that normalizing your data > by usage hour. I thought we deliberately couldn't correlate submissions over time belonging to the same user. Also, doing something fancy to normalize by hour is too complicated when the expectation is that the probe will confirm that the feature sees roughly no usage.
(In reply to Henri Sivonen (:hsivonen) from comment #15) > (In reply to Benjamin Smedberg [:bsmedberg] from comment #14) > > Usually the right question is how many *users* > > over a given time period are affected, or lacking that normalizing your data > > by usage hour. > > I thought we deliberately couldn't correlate submissions over time belonging > to the same user. We can do that. Can we move the discussion to a bug that's specific to the problem you are trying to solve?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: