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
Example
Initialize Glean, register a ping and then send it.
let cfg = ConfigurationBuilder::new(true, "/tmp/data", "org.mozilla.glean_core.example").build();
glean::initialize(cfg, ClientInfoMetrics::unknown());
let prototype_ping = PingType::new("prototype", true, true, true, vec!());
prototype_ping.submit(None);
Modules
Handling the Glean upload logic.
The different metric types supported by the Glean SDK to handle data.
API definitions for the different metric types supported by the Glean SDK.
Structs
Metrics included in every ping as
client_info
.The common set of data shared across all different metric types.
The Glean configuration.
Configuration builder.
Representation of a date, time and timezone.
A snapshot of all buckets and the accumulated sum of a distribution.
The object holding meta information about a Glean instance.
How to specify the rate at which pings may be uploaded before they are throttled.
A rate value as given by its numerator and denominator.
Represents the recorded data for a single event.
Deserialized experiment data.
Identifier for a running timer.
Enums
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).
Functions
Returns a timestamp corresponding to “now” with millisecond precision.
Set the remote configuration values for the metrics’ disabled property
Performs the collection/cleanup operations required by becoming active.
Performs the collection/cleanup operations required by becoming inactive.
Creates and initializes a new Glean object.
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.Sets a debug view tag.
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.
Sets the log pings debug option.
Sets source tags.
Sets whether upload is enabled or not.
Shuts down Glean in an orderly fashion.
Collects and submits a ping for eventual uploading by name.
TEST ONLY FUNCTION.
Returns the
RecordedExperiment
for the given experiment_id
or panics if
the id isn’t found.TEST ONLY FUNCTION.
Gets stored experimentation id.
TEST ONLY FUNCTION.
Checks if an experiment is currently active.
TEST ONLY FUNCTION.
Resets the Glean state and triggers init again.