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::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::EventMetric;pub use crate::metrics::MemoryDistributionMetric;pub use crate::metrics::MemoryUnit;pub use crate::metrics::NumeratorMetric;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
- 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
- Metrics included in every ping as
client_info. - The common set of data shared across all different metric types.
- A specialized
Errortype for this crate’s operations. - The object holding meta information about a Glean instance.
- Configuration for Glean
- A labeled metric.
- How to specify the rate at which pings may be uploaded before they are throttled.
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.
Traits
- Trait for metrics that can be nested inside a labeled metric.
- 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.
- 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.
- 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
RecordedExperimentfor the givenexperiment_idorNoneif the id isn’t found. - TEST ONLY FUNCTION. Gets stored experimentation id annotation.
- 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 Aliases
- A labeled boolean.
- A labeled counter.
- A labeled string.
- A specialized
Resulttype for this crate’s operations.