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 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)
"""
await graphite_conn.send(metric, value, timestamp)


"""
  Send a list of tuples List[(metric, value , timestamp)]
"""
await 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)
await graphite_conn.send(metric, value, timestamp)


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

Example

A simple example.

from aiographite.protocol import PlaintextProtocol
from 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


Download files

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

Source Distribution

aiographite-0.1.7.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiographite-0.1.7-py2.py3-none-any.whl (11.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file aiographite-0.1.7.tar.gz.

File metadata

  • Download URL: aiographite-0.1.7.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiographite-0.1.7.tar.gz
Algorithm Hash digest
SHA256 bc64fae795a9d1bcc30ef3015cdc71c16ca72f53a2bbf4bb7e8a87c914199aa3
MD5 6799e061f98b48a6c26b62aceec7931b
BLAKE2b-256 776e40732e2c86acd143c1aa066f368e83b6586413aa3f1cd392cf65e668869e

See more details on using hashes here.

File details

Details for the file aiographite-0.1.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for aiographite-0.1.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 49e05d5490b95c05900dcdfdeeb07e08e7b75fdcb431462b35b2adbbc7aed69e
MD5 0a8d5c4ee6f0a5f7284f14524a79c474
BLAKE2b-256 18940c4c5f4d3020dcc977eaa95f0e7ea81cfa7b0951cfcba2f20321a75fd5a6

See more details on using hashes here.

Supported by

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