Skip to main content

aiographite

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 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:

Metadata

Release files for aiographite 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiographite 0.2.0
File Size Uploaded
aiographite-0.2.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiographite 0.2.0
File Interpreter ABI Platform
aiographite-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / aiographite-0.2.0.tar.gz

Download URL aiographite-0.2.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9016e91929c37693ff21100eda917b37ec4d435ea230dd8913c2a2f8e75bb613
BLAKE2b-256 checksum
How to use checksums
1b731163c4ce2679a590dc9248c2baf6ed982494383db6423f94103311592672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / aiographite-0.2.0-py3-none-any.whl

Download URL aiographite-0.2.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10386908c964213266fcc98a2e0781925bce1c35a261740402dbb425f90a762d
BLAKE2b-256 checksum
How to use checksums
6d015142990e5b05386219ab4c93633a7abc43383a3f882c4f3c6af1e9515413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page