Skip to main content

An asyncio transport for raven-python

Project description

.. raw:: html

<p align="center">

.. image:: https://sentry-brand.storage.googleapis.com/sentry-logo-black.png
:target: https://sentry.io
:align: center
:width: 116
:alt: Sentry website

.. raw:: html

</p>

===========================================================
Raven-Aiohttp - Asyncio Transport for the Sentry Python SDK
===========================================================

.. image:: https://img.shields.io/pypi/v/raven-aiohttp.svg
:target: https://pypi.python.org/pypi/raven-aiohttp
:alt: PyPi page link -- version

.. image:: https://travis-ci.org/getsentry/raven-aiohttp.svg?branch=master
:target: https://travis-ci.org/getsentry/raven-aiohttp

.. image:: https://img.shields.io/pypi/l/raven-aiohttp.svg
:target: https://pypi.python.org/pypi/raven-aiohttp
:alt: PyPi page link -- BSD licence

.. image:: https://img.shields.io/pypi/pyversions/raven-aiohttp.svg
:target: https://pypi.python.org/pypi/raven-aiohttp
:alt: PyPi page link -- Python versions


A transport for the `Sentry Python SDK`_ which supports Python 3's asyncio interface.
For more information about Sentry and the python SDK, see our `Python Documentation`_ for framework integrations
and other goodies.

Requirements
============

- `raven-python>=5.4.0`
- `python>=3.4.2`
- `aiohttp>=2.0`

Usage
=====

`raven-aiohttp` ships two asyncio based transports for `raven.Client`: `AioHttpTransport` and `QueuedAioHttpTransport`.

AioHttpTransport
----------------

All messages to the sentry server will be produced by "Fire And Forget"

Each new message spawns it owns `asyncio.Task`, amount of them is not limited

.. code-block:: python

import asyncio

from raven import Client
from raven_aiohttp import AioHttpTransport

client = Client(transport=AioHttpTransport)

try:
1 / 0
except ZeroDivisionError:
client.captureException()

# graceful shutdown waits until all pending messages are send

loop = asyncio.get_event_loop()
loop.run_until_complete(client.remote.get_transport().close())


QueuedAioHttpTransport
----------------------

All messages to the sentry server will be produced by queue system

When transport is created it spawns limited amount of `asyncio.Task`
which sends messages one by one from internal `asyncio.Queue`

.. code-block:: python

import asyncio
from functols import partial

from raven import Client
from raven_aiohttp import QueuedAioHttpTransport

client = Client(transport=partial(QueuedAioHttpTransport, workers=5, qsize=1000))

try:
1 / 0
except ZeroDivisionError:
client.captureException()

# graceful shutdown waits until internal queue is empty

loop = asyncio.get_event_loop()
loop.run_until_complete(client.remote.get_transport().close())



Resources
=========

* `Sentry`_
* `Python Documentation`_
* `Issue Tracker`_
* `IRC Channel`_ (irc.freenode.net, #sentry)

.. _Sentry: https://getsentry.com/
.. _Sentry Python SDK: https://github.com/getsentry/raven-python
.. _Python Documentation: https://docs.getsentry.com/hosted/clients/python/
.. _Issue Tracker: https://github.com/getsentry/raven-aiohttp/issues
.. _IRC Channel: irc://irc.freenode.net/sentry




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

raven-aiohttp-0.6.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

raven_aiohttp-0.6.0-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file raven-aiohttp-0.6.0.tar.gz.

File metadata

File hashes

Hashes for raven-aiohttp-0.6.0.tar.gz
Algorithm Hash digest
SHA256 1513186ff77598051304c7b641e7c04bef9465e3d74c22688522906fe95e208c
MD5 ffdea18a0a9d9c4043844ef6a88c6603
BLAKE2b-256 51e7985d8706009730b59c374792917bd791e60d85b5e0002bcd65f6632a7769

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for raven_aiohttp-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 117cfd86f061fd11a7545c84d799668e043ed9e10b53b6e240d7ed93f9f3b289
MD5 ed60bc349564e5dbf86b9eebe48e1301
BLAKE2b-256 08ad125fe40578107cecd5e82246650534e9065192f23dd8b757f0a6f035e623

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