Late in 2018 we landed a basic implementation of the Telemetry multi-store.
Telemetry multi-store allows the re-use of probes across multiple pings, with 
each ping having their own schedule to be sent.
It ships in Firefox 65.

Overview

The lifetime of Telemetry probes (scalars & histograms) and thus their reset 
cycle were previously closely tied to the main ping.
Custom pings had to keep track of their own data or copy out data from 
Telemetry probes.

Multi-store will now make it easier to do this without custom code to store the 
probe data.
This way data collections can still be in Histograms.json, Scalars.yaml, and 
Events.yaml and benefit from documentation, expiration, and tool integration
(like the Probe Dictionary) but be used by custom pings that have custom client 
data lifetime requirements.

Technical details

Probes (scalars & histograms) can now specify additional stores through the 
“record_into_store” property, defaulting to a single “main” store (used for the 
main ping).
Recording will happen into every store automatically.
Additionally we provide new APIs for accessing snapshots of the data:

  getSnapshotForHistograms(storeName, clearStore)
  getSnapshotForKeyedHistograms(storeName, clearStore)
  getSnapshotForScalars(storeName, clearStore)
  getSnapshotForKeyedScalars(storeName, clearStore)

Custom pings will add their store to the probes they want to include and when 
assembling the ping payload call one of the above snapshot methods to get the 
data (and clear it).

You can find a more detailed blog post with some sample code here:
https://fnordig.de/2019/01/22/multi-store-custom-telemetry-with-shared-data/
 <https://fnordig.de/2019/01/22/multi-store-custom-telemetry-with-shared-data/>
Telemetry APIs

The Firefox Telemetry APIs now include:

- Privileged Firefox JavaScript through nsITelemetry
<https://searchfox.org/mozilla-central/source/toolkit/components/telemetry/nsITelemetry.idl>,
 including the new snapshot APIs
- Submitting custom pings
<https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/collection/custom-pings.html>
- C++ code through Telemetry.h
<https://searchfox.org/mozilla-central/source/toolkit/components/telemetry/core/Telemetry.h>
- WebExtensions through browser.telemetry
<https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/collection/webextension-api.html>
- Specific in-product Mozilla websites through Hybrid Content Telemetry
<https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/collection/hybrid-content.html>
- (newly introduced) shared test utilities in TelemetryTestUtils 
<https://searchfox.org/mozilla-central/source/toolkit/components/telemetry/tests/utils/TelemetryTestUtils.jsm>


As always, please do reach out if you have any questions or concerns. 
You can find us in #telemetry on IRC, #fx-metrics on Slack and the fx-data-dev 
<https://mail.mozilla.org/listinfo/fx-data-dev> mailing list.

Your Friendly Neighbourhood Firefox Telemetry Team
(:janerik, gfritzsche, :Dexter, :chutten, :travis_)
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to