Base10 is a metrics abstractoin layer for linking multiple metrics source and stores. It also simplifies metric creation and proxying.
Project description
Base10 is a metrics abstractoin layer for linking multiple metrics source and stores. It also simplifies metric creation and proxying.
Documentation
Base10’s documentation can be found at https://base10.readthedocs.io
Example
This shows a simple metric generator that writes a JSON formatted metric, containing a random value, to RabbitMQ.
from random import random
from time import sleep
from base10 import MetricHelper, MetricHandler
from base10.dialects import JSONDialect
from base10.transports import RabbitMQWriter
if __name__ == '__main__':
class MyMetric(MetricHelper):
_name = 'metric'
_fields = [
'value',
]
_metadata = [
'hostname',
]
class JSON(MetricHandler):
_dialect = JSONDialect()
_writer = RabbitMQWriter(
broker='127.0.0.1', exchange='amq.topic', topic='metrics.example')
json = JSON()
while True:
json.write(MyMetric(value=random(), hostname='test'))
sleep(1)
This shows a simple proxy that reads JSON formatted metrics from RabbitMQ and outputs them in InfluxDB format over a UDP socket.
from base10 import MetricHandler
from base10.dialects import JSONDialect, SplunkDialect #InfluxDBDialect
from base10.transports import RabbitMQReader, UDPWriter
if __name__ == '__main__':
class RabbitMQ(MetricHandler):
_dialect = JSONDialect()
_reader = RabbitMQReader(
broker='127.0.0.1', exchange='amq.topic', routing_key='metrics.#')
class InfluxDB(MetricHandler):
_dialect = SplunkDialect() #InfluxDBDialect()
_writer = UDPWriter(host='127.0.0.1', port=10000)
rabbitmq = RabbitMQ()
influxdb = InfluxDB()
for metric in rabbitmq.read():
influxdb.write(metric)
Contributing
To contribute to base10, please make sure that any new features or changes to existing functionality include test coverage.
Pull requests that add or change code without coverage will most likely be rejected.
Additionally, please format your code using yapf with google style prior to issuing your pull request.
yapf --style=google -i -r base10
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file base10-0.5.3.tar.gz
.
File metadata
- Download URL: base10-0.5.3.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b83ac06707860f2970d67a79e566b52e5ac4249d31e47fd8a702f4f1d3cf4620 |
|
MD5 | 756a7e81945dc020e09dbab91811308b |
|
BLAKE2b-256 | f3af6384cf14ff677664948a166210232f345650201f5c3717488f2772f14dad |
File details
Details for the file base10-0.5.3-py2.py3-none-any.whl
.
File metadata
- Download URL: base10-0.5.3-py2.py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26cf0de0f6ecc1884b9a8c6c7f359bd5a8e72f345d9e5ee155f1ca1d67c3d74c |
|
MD5 | 254d8e002438ce83d62b1bfe92f30bbb |
|
BLAKE2b-256 | 866fffe03a9f742c52defad3cfe95e2a00a34946a9dcf2bc7a2f71b8481e6e72 |