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::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§

AttributionMetrics
Optional product attribution metrics carried in client_info.attribution.
ClientInfoMetrics
Metrics included in every ping as client_info.
CommonMetricData
The common set of data shared across all different metric types.
DistributionMetrics
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.
InternalConfiguration
Configuration for Glean
LabeledMetric
A labeled metric.
PingRateLimit
How to specify the rate at which pings may be uploaded before they are throttled.
UniFfiTraitVtableGleanEventListener
UniFfiTraitVtableOnGleanEvents

Enums§

CallbackError
An error returned from callbacks.
DynamicLabelType
The type of dynamic label applied to a base metric. Used to help identify the necessary validation to be performed.
ErrorKind
A list enumerating the categories of errors in this crate.
ErrorType
The possible error types for metric recording.
HistogramType
Different kinds of histograms.
LabeledMetricData
The metric data needed to construct inner submetrics.
Lifetime
The supported metrics’ lifetimes.

Traits§

AllowLabeled
Trait for metrics that can be nested inside a labeled metric.
GleanEventListener
A callback handler that receives the base identifier of recorded events The identifier is in the format: <category>.<name>
OnGleanEvents
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 given experiment_id or None 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§

LabeledBoolean
A labeled boolean.
LabeledCounter
A labeled counter.
LabeledCustomDistribution
A labeled custom_distribution.
LabeledMemoryDistribution
A labeled memory_distribution.
LabeledQuantity
A labeled quantity
LabeledString
A labeled string.
LabeledTimingDistribution
A labeled timing_distribution.
Result
A specialized Result type for this crate’s operations.