Support Custom Ping Unit Tests in FOG's JS and C++ languages
Categories
(Toolkit :: Telemetry, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox90 | --- | fixed |
People
(Reporter: chutten, Assigned: chutten)
References
(Blocks 1 open bug)
Details
(Whiteboard: [telemetry:fog:m?])
Attachments
(2 files)
Following the design in bug 1681742 (proposal doc), implement a mechanism to unit test custom pings in C++ and JS.
Don't forget tests (GTests and xpcshell) and documentation (in the Glean Book). Due to the (likely) language-specific nature of the API, I don't expect this to have to block on work in bug 1685401, but we should coordinate so that any changes to the design are reflected equivalently across the languages.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
I hear from Mossop that a way to do this would be the way nsITimer
does with nsITimerCallback
: apply the function
annotation to the functor so that the JS API can take a function directly.
Then in C++ we could take std::function<void(const nsACString& aReason)> const&
so we could take lambda expressions.
The idea'd be, for JS:
GleanPings.myPing.testBeforeNextSubmit((reason) => { /* ... */ });
C++:
mozilla::glean_pings::MyPing.TestBeforeNextSubmit([](const nsACString& aReason) { /* ... */ });
Assignee | ||
Comment 2•4 years ago
|
||
Assignee | ||
Comment 3•4 years ago
|
||
Two notes:
- To make builds faster and hide the callback map, I've pulled the C++ impl
into Ping.cpp.
Doing this for the rest of the metrics is bug 1705394. - Doesn't wait on the queue to drain, actually writing metric values.
This means that the callback may be running before values reach the db.
This is surprisingly okay! Because the only way to check metrics values is
testGetValue which, you guessed it, waits on the queue to drain.
Depends on D112219
Comment 5•4 years ago
•
|
||
Backed out 2 changesets (bug 1685402) for build bustages in toolkit/components/glean/bindings/private/Ping.cpp. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer?job_id=337022729&repo=autoland&lineNumber=31419
Push with failures:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=f9eb32e83608aeedb90cad1afded194cf97810ca
Backout:
https://hg.mozilla.org/integration/autoland/rev/6a25903b5467b601bb5a74dbb076ab1bf337b9bc
Comment 6•4 years ago
|
||
Backout merged: https://hg.mozilla.org/mozilla-central/rev/6a25903b5467
Assignee | ||
Comment 7•4 years ago
|
||
Oh, I didn't ifdef out an unused function in the android build (GetCallbackMapLock
). Easy enough to fix. I really do wish I could compile with warnings-as-errors locally, but there's way too much GTK nonsense for that ever to clear up.
Not sure quite what went wrong with the backout that caught bug 1704846 in the mix, but I'll see what I can do to land these both more sedately this time.
Comment 9•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/76ae5fc0cc74
https://hg.mozilla.org/mozilla-central/rev/a0e7ceed0a81
Description
•