albertopinardi / py-vigil-reporter

Vigil Reporter module for Python 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py-vigil-reporter

PyPI license codecov downloads

Vigil Reporter for Python. Used in pair with Vigil, the Microservices Status Page.

Who uses it?

Smartphoniker

How to install

Install with pip:

$ pip install py-vigil-reporter

How to use

vigil-reporter can be instantiated as such:

from vigil_reporter.reporter import VigilReporter

SAMPLE_CONFIG = {
    "url": "http://localhost:8080",
    "token": "REPLACE_THIS_WITH_A_SECRET_KEY",
    "probe_id": "stats",
    "node_id": "stats-node",
    "replica_id": "192.168.1.103",
    "interval": 5
}
reporter = VigilReporter.from_config(SAMPLE_CONFIG)
reporter.start_reporting()
print("You can continue with your normal work here!")

This module uses the threading.Timer class from the threading module to run reporting in background. This makes the method non-blocking.

NOTE: The threaded execution drifts about +/- 0.05 seconds. But this won't be an issue, as you should set an interval that is greater than 1.0 seconds.

For further details see this Stackoverflow post.

What is Vigil?

ℹ️ Wondering what Vigil is? Check out valeriansaliou/vigil.

About

Vigil Reporter module for Python 3.

License:MIT License


Languages

Language:Python 98.5%Language:Makefile 1.5%