netflix-spectator-py is a thin-client library for reporting metrics from Python applications to SpectatorD and the Netflix Atlas Timeseries Database. It is currently at version 1.1.2 and maintains an active release cadence, providing continuous bug fixes and feature enhancements.
pip install netflix-spectator-pyVerified import paths — ran on the pinned version, not inferred.
Initializes a `Registry` with an optional `Config` for common tags, then demonstrates basic usage of `Counter`, `Timer`, and `Gauge` to report metrics. By default, metrics are sent via UDP to a local SpectatorD agent.
Initialize `Registry` within each child process's main execution block, or use a multiprocessing-safe method for managing the registry instance, such as passing metrics back to a single reporting process.
Pre-aggregate metrics within your application and report them at a cadence closer to SpectatorD's publish interval (e.g., every 5 seconds).
Ensure all tag keys and values are explicitly cast to strings before being passed to `with_tag()` or `with_tags()` methods. Monitor `spectator.meter.meter_id` logger at `WARNING` or `DEBUG` level for validation issues.
Replace `from spectator import GlobalRegistry` and `GlobalRegistry.counter(...)` with `from spectator import Registry, Config` and `registry = Registry(Config(...)); registry.counter(...)`.
For explicit `Registry` instances, ensure `.stop()` is called (e.g., in a `finally` block or application shutdown hook). For `GlobalRegistry` in tests or short scripts, consider `spectator.GlobalRegistry.stop()` explicitly, or switch to an explicit `Registry` instance for better lifecycle management.
Install the library using pip: `pip install netflix-spectator-py`. Ensure you are running your script with the Python interpreter where the library was installed.
Always cast tag keys and values to strings: `tags={'status': str(status_code)}` or `id.with_tag('value', str(my_int_value))`.No dependency data recorded yet.