Skip to main content

Snapshot PyPI version

spectator-py-runtime-metrics

Library to collect runtime metrics for Python applications using spectator-py.

See the Atlas Documentation site for more details on spectator-py.

Instrumenting Code

from spectator.registry import Registry
from runmetrics.stats_collector import StatsCollector

if __name__ == "__main__":
    registry = Registry()
    # optionally add a stable worker id tag to runtime metrics, for forked processes
    StatsCollector(registry, worker_id=None).start()

Worker IDs

For long-running Python applications, it is common to use a forking process model to increase the ability to handle load. Usually, these rely upon the pid to uniquely identify the workers, but some of these frameworks offer either a stable worker id or the ability to create stable worker id values through the addition of callbacks.

Ideally, the worker id is a string in the range 0..N, with N<16 in most cases. Most process forking frameworks have a configuration setting for the maximum number of workers, which helps to keep these values constrained.

Using raw str(os.getpid()) values as the worker id is not recommended, because it can lead to large increases in metrics volume in the Atlas backend, if processes restart regularly over the lifetime of an instance.

References

Local Development

Install pyenv, possibly with Homebrew, and install a recent Python version.

make setup-venv
make test
make coverage

Metadata

Release files for netflix-spectator-py-runtime-metrics 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netflix-spectator-py-runtime-metrics 1.0.4
File Size Uploaded
netflix_spectator_py_runtime_metrics-1.0.4.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for netflix-spectator-py-runtime-metrics 1.0.4
File Interpreter ABI Platform
netflix_spectator_py_runtime_metrics-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / netflix_spectator_py_runtime_metrics-1.0.4.tar.gz

Download URL netflix_spectator_py_runtime_metrics-1.0.4.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0c8eaf8457d100b8c7142a2d4f38b6fba5e12368b3f5f77259cf189f3324d733
BLAKE2b-256 checksum
How to use checksums
78b0587a8c680527ff033342828c1c1d5b9e97eb95fbcd17f71a60608fd674d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / netflix_spectator_py_runtime_metrics-1.0.4-py3-none-any.whl

Download URL netflix_spectator_py_runtime_metrics-1.0.4-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e36ec021ab5ded6398c28f3685ebdb7a795ea7473cb29ace075b63c3971aadb
BLAKE2b-256 checksum
How to use checksums
be30b8f5f3a8efcf9e99ee3ee1cb248fe727b46536735521c8e762b3e1e9c9e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page