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::BooleanMetric;
pub use crate::metrics::CounterMetric;
pub use crate::metrics::CustomDistributionMetric;
pub use crate::metrics::Datetime;
pub use crate::metrics::DatetimeMetric;
pub use crate::metrics::DenominatorMetric;
pub use crate::metrics::DistributionData;
pub use crate::metrics::DualLabeledCounterMetric;
pub use crate::metrics::EventMetric;
pub use crate::metrics::LocalCustomDistribution;
pub use crate::metrics::LocalMemoryDistribution;
pub use crate::metrics::LocalTimingDistribution;
pub use crate::metrics::MemoryDistributionMetric;
pub use crate::metrics::MemoryUnit;
pub use crate::metrics::NumeratorMetric;
pub use crate::metrics::ObjectMetric;
pub use crate::metrics::PingType;
pub use crate::metrics::QuantityMetric;
pub use crate::metrics::Rate;
pub use crate::metrics::RateMetric;
pub use crate::metrics::RecordedEvent;
pub use crate::metrics::RecordedExperiment;
pub use crate::metrics::StringListMetric;
pub use crate::metrics::StringMetric;
pub use crate::metrics::TextMetric;
pub use crate::metrics::TimeUnit;
pub use crate::metrics::TimerId;
pub use crate::metrics::TimespanMetric;
pub use crate::metrics::TimingDistributionMetric;
pub use crate::metrics::UrlMetric;
pub use crate::metrics::UuidMetric;
pub use crate::upload::PingRequest;
pub use crate::upload::PingUploadTask;
pub use crate::upload::UploadResult;
pub use crate::upload::UploadTaskAction;
Modules§
- metrics
- The different metric types supported by the Glean SDK to handle data.
- ping
- Ping collection, assembly & submission.
- storage
- Storage snapshotting.
- traits
- API definitions for the different metric types supported by the Glean SDK.
- upload
- Manages the pending pings queue and directory.
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.
- 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.
- Internal
Configuration - Configuration for Glean
- Labeled
Metric - A labeled metric.
- Ping
Rate Limit - How to specify the rate at which pings may be uploaded before they are throttled.
- UniFfi
Trait Vtable Glean Event Listener - UniFfi
Trait Vtable OnGlean Events
Enums§
- Callback
Error - An error returned from callbacks.
- Dynamic
Label Type - The type of dynamic label applied to a base metric. Used to help identify the necessary validation to be performed.
- Error
Kind - A list enumerating the categories of errors in this crate.
- 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.
Traits§
- Allow
Labeled - Trait for metrics that can be nested inside a labeled metric.
- Glean
Event Listener - A callback handler that receives the base identifier of recorded events
The identifier is in the format:
<category>.<name>
- OnGlean
Events - A callback object used to trigger actions on the foreign-language side.
Functions§
- get_
timestamp_ ms - Returns a timestamp corresponding to “now” with millisecond precision.
- glean_
apply_ server_ knobs_ config - Sets a remote configuration to override metrics’ default enabled/disabled state
- glean_
enable_ logging - Initialize the logging system based on the target platform. This ensures that logging is shown when executing the Glean SDK unit tests.
- glean_
enable_ logging_ to_ fd - Initialize the logging system to send JSON messages to a file descriptor (Unix) or file handle (Windows).
- glean_
get_ debug_ view_ tag - Gets the currently set debug view tag.
- glean_
get_ log_ pings - Gets the current log pings value.
- glean_
get_ registered_ ping_ names - Gets a list of currently registered ping names.
- glean_
get_ upload_ task - Get the next upload task
- glean_
handle_ client_ active - Performs the collection/cleanup operations required by becoming active.
- glean_
handle_ client_ inactive - Performs the collection/cleanup operations required by becoming inactive.
- glean_
initialize - Initializes Glean.
- glean_
initialize_ for_ subprocess - Creates and initializes a new Glean object for use in a subprocess.
- glean_
persist_ ping_ lifetime_ data - Asks the database to persist ping-lifetime data to disk.
- glean_
process_ ping_ upload_ response - Processes the response from an attempt to upload a ping.
- glean_
register_ event_ listener - EXPERIMENTAL: Register a listener object to recieve notifications of event recordings.
- glean_
set_ collection_ enabled - Sets whether collection is enabled or not.
- glean_
set_ debug_ view_ tag - Sets a debug view tag.
- glean_
set_ dirty_ flag - TEST-ONLY Method
- glean_
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.
- glean_
set_ experiment_ inactive - Indicate that an experiment is no longer running.
- glean_
set_ experimentation_ id - Set an experimentation identifier dynamically.
- glean_
set_ log_ pings - Sets the log pings debug option.
- glean_
set_ source_ tags - Sets source tags.
- glean_
set_ test_ mode - TEST-ONLY Method
- glean_
set_ upload_ enabled - DEPRECATED Sets whether upload is enabled or not.
- glean_
shutdown - Shuts down Glean in an orderly fashion.
- glean_
submit_ ping_ by_ name - Collect and submit a ping for eventual upload by name.
- glean_
submit_ ping_ by_ name_ sync - Collect and submit a ping (by its name) for eventual upload, synchronously.
- glean_
test_ destroy_ glean - TEST-ONLY Method
- glean_
test_ get_ attribution - TEST-ONLY Method
- glean_
test_ get_ distribution - TEST-ONLY Method
- glean_
test_ get_ experiment_ data - TEST ONLY FUNCTION.
Returns the
RecordedExperiment
for the givenexperiment_id
orNone
if the id isn’t found. - glean_
test_ get_ experimentation_ id - TEST ONLY FUNCTION. Gets stored experimentation id annotation.
- glean_
unregister_ event_ listener - Unregister an event listener from recieving notifications.
- glean_
update_ attribution - Updates attribution fields with new values.
AttributionMetrics fields with
None
values will not overwrite older values. - glean_
update_ distribution - Updates distribution fields with new values.
DistributionMetrics fields with
None
values will not overwrite older values. - join_
init - TEST ONLY FUNCTION Waits on all the glean.init threads’ join handles.
- set_
ping_ enabled - Enable or disable a ping.
- shutdown
- Shuts down Glean in an orderly fashion.
- test_
get_ num_ recorded_ errors - Gets the number of recorded errors for the given metric and error type.
- uniffi_
glean_ core_ fn_ init_ callback_ vtable_ gleaneventlistener - uniffi_
glean_ core_ fn_ init_ callback_ vtable_ ongleanevents
Type Aliases§
- Labeled
Boolean - A labeled boolean.
- Labeled
Counter - A labeled counter.
- Labeled
Custom Distribution - A labeled custom_distribution.
- Labeled
Memory Distribution - A labeled memory_distribution.
- Labeled
Quantity - A labeled quantity
- Labeled
String - A labeled string.
- Labeled
Timing Distribution - A labeled timing_distribution.
- Result
- A specialized
Result
type for this crate’s operations.