fxa_client/
telemetry.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5//! # Telemetry Methods
6//!
7//! This component does not currently submit telemetry via Glean, but it *does* gather
8//! a small amount of telemetry about send-tab that the application may submit on its
9//! behalf.
10
11use crate::{ApiResult, Error, FirefoxAccount};
12use error_support::handle_error;
13
14impl FirefoxAccount {
15    /// Collect and return telemetry about send-tab attempts.
16    ///
17    /// Applications that register the [`SendTab`](DeviceCapability::SendTab) capability
18    /// should also arrange to submit "sync ping" telemetry. Calling this method will
19    /// return a JSON string of telemetry data that can be incorporated into that ping.
20    ///
21    /// Sorry, this is not particularly carefully documented because it is intended
22    /// as a stop-gap until we get native Glean support. If you know how to submit
23    /// a sync ping, you'll know what to do with the contents of the JSON string.
24    #[handle_error(Error)]
25    pub fn gather_telemetry(&self) -> ApiResult<String> {
26        self.internal.lock().gather_telemetry()
27    }
28}