Skip to main content

Base10 is a metrics abstractoin layer for linking multiple metrics source and stores. It also simplifies metric creation and proxying.

Project description

Compatibility Implementations Format Downloads

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

Installing Base10

Base10 can be installed from Pypi using pip:

pip install base10

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 facebook style prior to issuing your pull request.

yapf --style=facebook -i -r base10 setup.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

base10-0.6.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

base10-0.6.0-py2.py3-none-any.whl (13.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file base10-0.6.0.tar.gz.

File metadata

  • Download URL: base10-0.6.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for base10-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8cdabe3eabb35360d4781a311250eaa05dcebb97371f4958d33350dd7e2d3a22
MD5 3df81d4593e18781c754a300f50440ad
BLAKE2b-256 d198769596e1fb0633ceb5c8922de6d330d895588cb7de196e0244a2ef56ac61

See more details on using hashes here.

File details

Details for the file base10-0.6.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for base10-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 80da6a5f03d3a12b517e18d89e929de07af24ac63bea10af6ad07a26952fa1f1
MD5 f6c163cee9e41ff58711158bb863140e
BLAKE2b-256 2cff0d526375220202a8d3231981e5e6373539159a134f6ab95aec31034b1e41

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page