A pytest plugin that reports test results to a Loki instance.
There is no pypi repo yet. You can however install it with pip directly from github:
pip install git+https://github.com/EasyMile/pytest-loki.git@v0.1.3You can also install it manually using setup.py.
Once installed, it'll automatically register as a pytest plugin - no extra steps needed. If no loki url is provided the plugin will not do anything.
When invoking py.test, provide the following arguments:
-
--loki-urlURL to the Loki instance to send log lines to. Authentication is supported via
--loki-basic-auth. -
--loki-metrics-prefixEach metric exported will be prefixed with this.
-
--loki-env-labelEnvironment variables to use as labels. Will be lowercased for readability. Can be renamed with
ENV_VAR=renamed_keysyntax. Can be repeated many times. -
--loki-extra-labelThis takes values of form
key=value, and each metric will have these key value pairs as labels. Can be repeated many times. -
--loki-env-valueEnvironment variables to use as key=value in log lines. Will be lowercased. Key can be renamed with
ENV_VAR=new_keysyntax. Can be repeated many times. -
--loki-basic-authOptional HTTP Basic auth credentials in the format
user:password. -
--loki-retry-attemptsNumber of retry attempts for pushing to Loki (default: 3).
-
--loki-retry-intervalInterval in seconds between each retry attempt for pushing to Loki (default: 30).
pytest-prometheus was an inspiration for this codebase!