Python library to aid consistent configuration of logging, metrics (future) and tracing (further in future). Packaging and wiring existing open tooling to work effortlessly on UIS DevOps managed cloud infrastructure.
Project description
Observability Python Library
Currently a POC in the Wilson team. Python library to aid consistent configuration of logging, metrics (future) and tracing (further in future). Packaging and wiring existing open tooling to work effortlessly on UIS DevOps managed cloud infrastructure.
Install this module
pip install ucam-observe
Usage
Logging
NOTE: Currently only vanilla python is supported, not Django.
Usage is similar to using structlog
directly with the function get_structlog_logger
returning
an object compatible with that returned by structlog
's get_logger
function. No further
configuration is needed.
logger = get_structlog_logger(__name__)
logger.info("some_event")
logger.info("some_other_event", foo=bar)
Metrics and Tracing
raise NotImplemented
Include Gunicorn structlog configuration in your project
Adapt Gunicorn configuration
In the root of your project, create/amend a gunicorn.conf.py. Add the following code to the file.
from ucam_observe.gunicorn_conf import configure_logging
configure_logging()
Developer quickstart
Firstly, install docker-compose. Install poethepoet
pip install poethepoet
Then, most tasks can be performed via the poe command.
E.g.
# Build the containers
$ poe build
Run the follow command to see available commands:
$ poe
Optional extras
NOTE: The Django optional extra is currently empty with a ticket open to add the required functionality
This library includes optional extras, e.g. ucam-observe[django]
. Some
tests will require these optional dependencies to pass. The following command
will install all optional dependencies.
$ poe install-all-extras
Some tests require the absence of dependencies and these are excluded by default. See the tox.ini file for how these tests are run.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ucam_observe-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48fcbcd206eb65ff70c80a72929becdc077f57d7742000b1d46a9c12b50361c3 |
|
MD5 | 08e74a5cb697d2ac5a58bb171b9d06a9 |
|
BLAKE2b-256 | 9f997d306d16adce0af804f01ac6857601c804bebbb4232f1204d08cba087901 |