Overview
The Glean SDKs are available for several programming languages and development environments.
Although there are different SDKs, each of them is based off of either a JavaScript core or a Rust core. These cores contain the bulk of the logic of the client libraries. Thin wrappers around them expose APIs for the target platforms. Each SDK may also send a different set of default pings and collect a different set of default metrics.
Finally, each SDK may also be1 accompanied by glean_parser
, a Python command line utility
that provides a list of useful development tools for developers instrumenting a project using Glean.
Some SDKs are not bundled with glean_parser
and it is left to the user to install it separately.
Rust Core-based SDKs
The code for the Rust Core-based SDKs is available on the
mozilla/glean
repository.
These group of SDKs were previously referred to as "language bindings" i.e. "the Kotlin language bindings" or "the Python language bindings".
Rust
The Glean Rust SDK can be used with any Rust application. It can serve a wide variety of usage patterns, such as short-lived CLI applications as well as longer-running desktop or server applications. It can optionally send builtin pings at startup. It does not assume an interaction model and the integrating application is responsible to connect the respective hooks.
It is available as the glean
crate on crates.io.
Kotlin
The Glean Kotlin SDK is primarily used for integration with Android applications. It assumes a common interaction model for mobile applications. It sends builtin pings at startup of the integrating application.
It is available standalone as org.mozilla.telemetry:glean
or via Android Components as org.mozilla.components:service-glean
from the Mozilla Maven instance.
The Kotlin SDK can also be used from Java.
See Android for more on integrating Glean on Android.
Swift
The Glean Swift SDK is primarily used for integration with iOS applications. It assumes a common interaction model for mobile applications. It sends builtin pings at startup of the integrating application.
It is available as a standalone Xcode framework from the Glean releases page or bundled with the AppServices framework.
Python
The Glean Python SDK allows integration with any Python application. It can serve a wide variety of usage patterns, such as short-lived CLI applications as well as longer-running desktop or server applications.
It is available as glean-sdk
on PyPI.
JavaScript Core-based SDKs
The code for the JavaScript Core-based SDKs is available on the
mozilla/glean.js
repository.
This collection of SDKs is commonly referred to as Glean.js.
JavaScript
The Glean JavaScript SDK allows integration with three distint JavaScript environments: websites, web extension and Node.js.
It is available as @mozilla/glean
on npm.
This package has different entry points to access the different SDKs.
@mozilla/glean/web
gives access to the websites SDK@mozilla/glean/webext
gives access to the web extension SDK@mozilla/glean/node
gives access to the Node.js SDK
QML
The Glean QML SDK allows integration with Qt/QML applications and libraries.
It is available as a compressed file attached to each new Glean.js release and may be downloaded from the project GitHub releases page.