Skip to main content

No project description provided

Project description

build status coverage status

An asyncio library for graphite.

You can find out more here:

http://aiographite.readthedocs.io/en/latest/

What is aiographite ?

aiographite is Python3 library ultilizing asyncio, designed to help Graphite users to send data into graphite easily.

Installing it globally

You can install aiographite globally with any Python package manager:

pip install aiographite

Quick start

Let’s get started.

from aiographite.aiographite import connect
from aiographite.protocol import PlaintextProtocol

"""
  Initialize a aiographite instance
"""
loop = asyncio.get_event_loop()
plaintext_protocol = PlaintextProtocol()
graphite_conn = await aiographite.connect(*httpd.address, plaintext_protocol, loop=loop)


"""
  Send a tuple (metric, value , timestamp)
"""
graphite_conn.send(metric, value, timestamp)


"""
  Send a list of tuples List[(metric, value , timestamp)]
"""
graphite_conn.send_multiple(list)


"""
  aiographite library also provides GraphiteEncoder module,
  which helps users to send valid metric name to graphite.
  For Example: (metric_parts, value ,timestamp)
"""
metric = graphite_conn.clean_and_join_metric_parts(metric_parts)
graphite_conn.send(metric, value, timestamp)


"""
  Close connection
"""
graphite_conn.close()

Example

A simple example.

from aiographite.protocol import PlaintextProtocol
from aiographite.aiographite import connect
import time
import asyncio


LOOP = asyncio.get_event_loop()
SERVER = '127.0.0.1'
PORT = 2003


async def test_send_data():
  # Initiazlize an aiographite instance
  plaintext_protocol = PlaintextProtocol()
  graphite_conn = await connect(SERVER, PORT, plaintext_protocol, loop=LOOP)

  # Send data
  timestamp = time.time()
  for i in range(10):
    await graphite_conn.send("yun_test.aiographite", i, timestamp + 60 * i)))


def main():
  LOOP.run_until_complete(test_send_data())
  LOOP.close()


if __name__ == '__main__':
  main()

Development

Run unit tests.

./uranium test

Graphite setup

Do not have graphite instances ? Set up a graphite instance on your local machine!

Please refer:

Project details


Release history Release notifications

History Node

0.1.9

History Node

0.1.8

History Node

0.1.7

History Node

0.1.6

This version
History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.0.2

History Node

0.0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
aiographite-0.1.5-py2.py3-none-any.whl (11.3 kB) Copy SHA256 hash SHA256 Wheel 3.5 Nov 19, 2016
aiographite-0.1.5.tar.gz (7.6 kB) Copy SHA256 hash SHA256 Source None Nov 19, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page