Crate glean_core

source ·
Expand description

Glean is a modern approach for recording and sending Telemetry data.

It’s in use at Mozilla.

All documentation can be found online:

The Glean SDK Book

Re-exports

pub use crate::metrics::DistributionData;
pub use crate::upload::PingUploadTask;

Modules

The different metric types supported by the Glean SDK to handle data.
Ping collection, assembly & submission.
Storage snapshotting.
API definitions for the different metric types supported by the Glean SDK.
Manages the pending pings queue and directory.

Structs

A boolean metric.
Metrics included in every ping as client_info.
The common set of data shared across all different metric types.
A counter metric.
A custom distribution metric.
Representation of a date, time and timezone.
A datetime metric.
A Denominator metric (a kind of count shared among Rate metrics).
A specialized Error type for this crate’s operations.
An event metric.
The object holding meta information about a Glean instance.
Configuration for Glean
A labeled metric.
A memory distribution metric.
Developer-facing API for recording rate metrics with external denominators.
How to specify the rate at which pings may be uploaded before they are throttled.
Represents a request to upload a ping.
Stores information about a ping.
A quantity metric.
A rate value as given by its numerator and denominator.
A rate metric.
Represents the recorded data for a single event.
Deserialized experiment data.
A string list metric.
A string metric.
A text metric.
Identifier for a running timer.
A timespan metric.
A timing distribution metric.
A URL metric.
An UUID metric.

Enums

An error returned from callbacks.
A list enumerating the categories of errors in this crate.
The possible error types for metric recording. Note: the cases in this enum must be kept in sync with the ones in the platform-specific code (e.g. ErrorType.kt) and with the metrics in the registry files.
Different kinds of histograms.
The supported metrics’ lifetimes.
Different resolutions supported by the memory related metric types (e.g. MemoryDistributionMetric).
Different resolutions supported by the time related metric types (e.g. DatetimeMetric).
The result of an attempted ping upload.
Communication back whether the uploader loop should continue.

Traits

Trait for metrics that can be nested inside a labeled metric.
A callback handler that receives the base identifier of recorded events The identifier is in the format: .
A callback object used to trigger actions on the foreign-language side.

Functions

Returns a timestamp corresponding to “now” with millisecond precision.
Initialize the logging system based on the target platform. This ensures that logging is shown when executing the Glean SDK unit tests.
Initialize the logging system to send JSON messages to a file descriptor (Unix) or file handle (Windows).
Get the next upload task
Performs the collection/cleanup operations required by becoming active.
Performs the collection/cleanup operations required by becoming inactive.
Initializes Glean.
Creates and initializes a new Glean object for use in a subprocess.
Processes the response from an attempt to upload a ping.
EXPERIMENTAL: Register a listener object to recieve notifications of event recordings.
Sets a debug view tag.
TEST-ONLY Method
Indicate that an experiment is running. Glean will then add an experiment annotation to the environment which is sent with pings. This infomration is not persisted between runs.
Indicate that an experiment is no longer running.
Set an experimentation identifier dynamically.
Sets the log pings debug option.
Sets a remote configuration to override metrics’ default enabled/disabled state
Sets source tags.
TEST-ONLY Method
Sets whether upload is enabled or not.
Shuts down Glean in an orderly fashion.
Collect and submit a ping for eventual upload by name.
Collect and submit a ping (by its name) for eventual upload, synchronously.
TEST-ONLY Method
TEST ONLY FUNCTION. Returns the RecordedExperiment for the given experiment_id or None if the id isn’t found.
TEST ONLY FUNCTION. Gets stored experimentation id annotation.
Unregister an event listener from recieving notifications.
TEST ONLY FUNCTION Waits on all the glean.init threads’ join handles.
Asks the database to persist ping-lifetime data to disk. Probably expensive to call. Only has effect when Glean is configured with delay_ping_lifetime_io: true. If Glean hasn’t been initialized this will dispatch and return Ok(()), otherwise it will block until the persist is done and return its Result.
Shuts down Glean in an orderly fashion.
Gets the number of recorded errors for the given metric and error type.

Type Definitions

A labeled boolean.
A labeled counter.
A labeled string.
A specialized Result type for this crate’s operations.