1# Glean SDK 2 3The `Glean SDK` is a modern approach for a Telemetry library and is part of the [Glean project](https://docs.telemetry.mozilla.org/concepts/glean/glean.html). 4 5## `glean-core` 6 7This library provides the core functionality of the Glean SDK, including implementations of all metric types, the ping serializer and the storage layer. 8It's used in all platform-specific wrappers. 9 10It's not intended to be used by users directly. 11Each supported platform has a specific Glean package with a nicer API. 12A nice Rust API will be provided by the [Glean](https://crates.io/crates/glean) crate. 13 14## Documentation 15 16All documentation is available online: 17 18* [The Glean SDK Book][book] 19* [API documentation][apidocs] 20 21[book]: https://mozilla.github.io/glean/ 22[apidocs]: https://mozilla.github.io/glean/docs/glean_core/index.html 23 24## Usage 25 26```rust 27use glean_core::{Glean, Configuration, CommonMetricData, metrics::*}; 28let cfg = Configuration { 29 data_path: "/tmp/glean".into(), 30 application_id: "glean.sample.app".into(), 31 upload_enabled: true, 32 max_events: None, 33}; 34let mut glean = Glean::new(cfg).unwrap(); 35let ping = PingType::new("sample", true, true, vec![]); 36glean.register_ping_type(&ping); 37 38let call_counter: CounterMetric = CounterMetric::new(CommonMetricData { 39 name: "calls".into(), 40 category: "local".into(), 41 send_in_pings: vec!["sample".into()], 42 ..Default::default() 43}); 44 45call_counter.add(&glean, 1); 46 47glean.submit_ping(&ping, None).unwrap(); 48``` 49 50## License 51 52 This Source Code Form is subject to the terms of the Mozilla Public 53 License, v. 2.0. If a copy of the MPL was not distributed with this 54 file, You can obtain one at http://mozilla.org/MPL/2.0/ 55