Orwell Package For Building Translators
About
Orwell is an open-source platform that allows you to integrate different metrics collectors into one large super-system, storing the data from different sources in Prometheus' format.
With that goal in mind, this package tries to facilitate as much as possible the task of creating translator services compatible with Orwell's architecture.
Development
If a given service's output follows the scheme "host,metric,value", its translator could be built with the following example:
from orwell import Metric, Runner
# The translator function should be able to receive multiple lines
# of the desired service output and return a list of Metric objects
def translate (lines: str) -> list[Metric]:
metrics = [ line.split(',') for line in lines.split('\n') ]
return [ Metric(metric, value, { 'host': host }) for host, metric, value in metrics ]
translator = Runner(translate)
translator.run()
Usage
With the example given above we now have three options for running the service:
Command-Line Mode
python main.py cmd <output>
The output will be processed and printed.
Server Mode
python main.py server
A Flask server will start accepting POST requests for /metrics.
The body of the request must be a dictionary with the only key metrics.
The response will be the processed output whenever the status code is 200.
Environment Variables
FLASK_HOST
Default "localhost"
FLASK_PORT
Default "5000""
FLASK_DEBUG
If set the server will start in debug mode.
Production Mode
python main.py prod
This is the most important mode as it allows to read messages from Kafka and write them to a Redis database, according to the Orwell's architecture.
Environment Variables
REDIS_HOST
Default "localhost"
REDIS_PASSWORD
Default "root"
KAFKA_HOST
Default "localhost""
KAFKA_PORT
Default 9093
KAFKA_TOPIC
Default "general"
Pull Mode
python main.py pull
This mode allows gathering data from a custom endpoint.
Environment Variables
PULL_ENDPOINT
PULL_INTERVAL
Default "localhost"
REDIS_PASSWORD
Default "root"
Metadata
Release files for orwell-translators 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| orwell_translators-1.1.5.tar.gz | 7.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| orwell_translators-1.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / orwell_translators-1.1.5.tar.gz
| Download URL | orwell_translators-1.1.5.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc6b92446c1091ba4fc9fba9c70d7361d06d19792e83906f3306910f9ad77eb0
|
|
BLAKE2b-256 checksum How to use checksums |
b6c0461ce225dabbdf53da015190ac78813acfeb87593e951c109eea737ad9a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Release files / orwell_translators-1.1.5-py3-none-any.whl
| Download URL | orwell_translators-1.1.5-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16935b66ee350df9ce381c98d1ea9f001f9cb9b9adf941d2802e0aee28932716
|
|
BLAKE2b-256 checksum How to use checksums |
a1005c7011c4a5144c2802f6d34aa8f4c37ca63b687cd4c70ec00f2c17313a4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.4
|
Security for orwell-translators 1.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.