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, true, true, vec!(), vec!(), true, vec![]);
prototype_ping.submit(None);
Modules§
- net
- Handling the Glean upload logic.
- private
- The different metric types supported by the Glean SDK to handle data.
- traits
- API definitions for the different metric types supported by the Glean SDK.
Structs§
- Attribution
Metrics - Optional product attribution metrics carried in
client_info.attribution
. - Client
Info Metrics - Metrics included in every ping as
client_info
. - Common
Metric Data - The common set of data shared across all different metric types.
- Configuration
- The Glean configuration.
- Configuration
Builder - Configuration builder.
- Datetime
- Representation of a date, time and timezone.
- Distribution
Data - A snapshot of all buckets and the accumulated sum of a distribution.
- Distribution
Metrics - Optional product distribution metrics carried in
client_info.distribution
. - Error
- A specialized
Error
type for this crate’s operations. - Glean
- The object holding meta information about a Glean instance.
- Ping
Rate Limit - How to specify the rate at which pings may be uploaded before they are throttled.
- Rate
- A rate value as given by its numerator and denominator.
- Recorded
Event - Represents the recorded data for a single event.
- Recorded
Experiment - Deserialized experiment data.
- TimerId
- Identifier for a running timer.
Enums§
- Error
Type - The possible error types for metric recording.
- Histogram
Type - Different kinds of histograms.
- Labeled
Metric Data - The metric data needed to construct inner submetrics.
- Lifetime
- The supported metrics’ lifetimes.
- Memory
Unit - Different resolutions supported by the memory related metric types (e.g. MemoryDistributionMetric).
- Time
Unit - Different resolutions supported by the time related metric types (e.g. DatetimeMetric).
Traits§
- Metric
Identifier - A
MetricIdentifier
describes an interface for retrieving an identifier (category, name, label) for a metric
Functions§
- get_
registered_ ping_ names - Gets a list of currently registered ping names.
- get_
timestamp_ ms - Returns a timestamp corresponding to “now” with millisecond precision.
- glean_
apply_ server_ knobs_ config - Set the remote configuration values for the metrics’ disabled property
- glean_
get_ debug_ view_ tag - Gets the currently set debug view tag.
- glean_
get_ log_ pings - Gets the current log pings value.
- handle_
client_ active - Performs the collection/cleanup operations required by becoming active.
- handle_
client_ inactive - Performs the collection/cleanup operations required by becoming inactive.
- initialize
- Creates and initializes a new Glean object.
- persist_
ping_ lifetime_ data - Asks the database to persist ping-lifetime data to disk.
- set_
collection_ enabled - Sets whether upload is enabled or not.
- set_
debug_ view_ tag - Sets a debug view tag.
- set_
experiment_ active - 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.
- set_
experiment_ inactive - Indicate that an experiment is no longer running.
- set_
experimentation_ id - Dynamically set the experimentation identifier, as opposed to setting it through the configuration during initialization.
- set_
log_ pings - Sets the log pings debug option.
- set_
source_ tags - Sets source tags.
- set_
upload_ enabled - DEPRECATED Sets whether upload is enabled or not.
- shutdown
- Shuts down Glean in an orderly fashion.
- submit_
ping_ by_ name - Collects and submits a ping for eventual uploading by name.
- test_
get_ attribution - TEST-ONLY Method
- test_
get_ distribution - TEST-ONLY Method
- test_
get_ experiment_ data - TEST ONLY FUNCTION.
Returns the
RecordedExperiment
for the givenexperiment_id
or panics if the id isn’t found. - test_
get_ experimentation_ id - TEST ONLY FUNCTION. Gets stored experimentation id.
- test_
is_ experiment_ active - TEST ONLY FUNCTION. Checks if an experiment is currently active.
- test_
reset_ glean - TEST ONLY FUNCTION. Resets the Glean state and triggers init again.
- update_
attribution - Updates attribution fields with new values.
AttributionMetrics fields with
None
values will not overwrite older values. - update_
distribution - Updates distribution fields with new values.
DistributionMetrics fields with
None
values will not overwrite older values.