Registry / observability / glean-sdk

glean-sdk

JSON →
library67.5.0pypypi✓ verified 87d ago

Glean is a modern telemetry system by Mozilla for collecting, storing, and sending application metrics and pings. It provides a type-safe, cross-platform SDK with a metric API, automatic batching, and built-in pings. Current version is 67.2.0, with a regular release cadence aligned with Mozilla's release cycle.

pip install glean-sdk
INSTALL
IMPORT
SIG · GLEAN-SDK
G
glean-sdk
observabilitypythonv67.5.0
Install
3.2s avg
Import
822ms
Disk
33MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v67.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.2s · import 0.822s · 34MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Glean
from glean import Glean
from glean_sdk import Glean
Import directly from 'glean' for the main API
MetricsPing
from glean import MetricsPing
from glean.metrics import MetricsPing
BooleanMetricType
from glean.metrics import BooleanMetricType

Minimal example initializing Glean with a configurable server endpoint and a boolean metric.

import os import glean from glean import Glean, Configuration, MetricsPing from glean.metrics import BooleanMetricType # Initialize Glean with a custom server endpoint server_endpoint = os.environ.get('GLEAN_SERVER_ENDPOINT', 'https://example.com') app_id = 'my-app' Glean.initialize( application_id=app_id, application_version='1.0.0', upload_enabled=True, configuration=Configuration( server_endpoint=server_endpoint ) ) # Define a boolean metric my_metric = BooleanMetricType(1, 'test.bool') print('Glean initialized successfully')
Debug
Known issues
breakingStarting from version 50.0.0, the import path changed from `glean_sdk` to `glean`. Old code using `import glean_sdk` will break. Update imports to `from glean import ...`.
fix
Replace all `from glean_sdk import ...` with `from glean import ...`.
affects: >=50.0.0
breakingThe `MetricsPing` class was removed in version 60.0.0 in favor of automatic ping scheduling. Code importing `MetricsPing` will break.
fix
Remove MetricsPing usage; pings are now scheduled automatically. Use `Glean.initialize(...)` without explicitly scheduling pings.
affects: >=60.0.0
deprecatedThe `Glean.initialize()` parameter `data_dir` is deprecated since version 55.0.0. Use `Configuration.data_dir` instead.
fix
Pass `data_dir` inside `Configuration` object.
affects: >=55.0.0
gotchaGlean must be initialized only once. Calling `Glean.initialize()` multiple times raises an error or does nothing silently. Ensure initialization happens early and only once.
fix
Initialize Glean at application startup, guarded by a flag or on first launch.
affects: all
gotchaMetric identifiers must be kebab-case (e.g., 'category.name'). Using underscores or invalid characters will cause errors during metric registration.
fix
Ensure metric strings follow the '[a-z][a-z0-9-]{0,}[.][a-z][a-z0-9-]{0,}' pattern.
affects: all
Errors
Common errors & fixes
glean_sdk is not defined
Old import path using glean_sdk instead of glean.
fix
Use 'from glean import ...' instead of 'from glean_sdk import ...'.
Glean has already been initialized
Calling Glean.initialize() more than once in the same process.
fix
Guard initialization with a flag or ensure single call at startup.
Invalid metric identifier: 'my_metric'
Metric identifier must be in kebab-case (e.g., 'my.metric').
fix
Use valid identifier format like 'test.bool'.
ImportError: cannot import name 'MetricsPing' from 'glean'
MetricsPing was removed in version 60+.
fix
Remove MetricsPing; ping scheduling is automatic.
Upgrade
Version history
67.5.0latest on PyPI · released Jun 9, 2026
Audit
Dependencies
python-dateutilrequiredRequired for datetime parsing
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
2
Bingbot
1
Resources
glean-sdk — pip install glean-sdk · libregistry