Crate glean[−][src]
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 = Configuration { data_path: "/tmp/data".into(), application_id: "org.mozilla.glean_core.example".into(), upload_enabled: true, max_events: None, delay_ping_lifetime_io: false, channel: None, server_endpoint: None, uploader: None, }; glean::initialize(cfg, ClientInfoMetrics::unknown()); let prototype_ping = PingType::new("prototype", true, true, vec!()); glean::register_ping_type(&prototype_ping); 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
ClientInfoMetrics | Metrics included in every ping as |
CommonMetricData | The common set of data shared across all different metric types. |
Configuration | The Glean configuration. |
DistributionData | A snapshot of all buckets and the accumulated sum of a distribution. |
Error | A specialized |
Glean | The object holding meta information about a Glean instance. |
RecordedEvent | Represents the recorded data for a single event. |
Enums
ErrorType | 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. |
HistogramType | Different kinds of histograms. |
Lifetime | The supported metrics' lifetimes. |
MemoryUnit | Different resolutions supported by the memory related metric types (e.g. MemoryDistributionMetric). |
TimeUnit | Different resolutions supported by the time related metric types (e.g. DatetimeMetric). |
Functions
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. |
register_ping_type | Register a new |
rlb_flush_dispatcher | Unblock the global dispatcher to start processing queued tasks. |
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_log_pings | Sets the log pings debug option. |
set_source_tags | Sets source tags. |
set_upload_enabled | Sets whether upload is enabled or not. |
shutdown | Shuts down Glean. |
submit_ping_by_name | Collects and submits a ping for eventual uploading by name. |
test_reset_glean | TEST ONLY FUNCTION. Resets the Glean state and triggers init again. |
Type Definitions
Datetime | A datetime type. |
Result | A specialized |
TimerId | Identifier for a running timer. |