Vigil Reporter for Python. Used in pair with Vigil, the Microservices Status Page.
Smartphoniker |
Install with pip:
$ pip install py-vigil-reporter
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.
ℹ️ Wondering what Vigil is? Check out valeriansaliou/vigil.