Skip to main content

An asyncio transport for raven-python

Project description

PyPi page link -- version https://travis-ci.org/getsentry/raven-aiohttp.svg?branch=master PyPi page link -- BSD licence 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

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

import asyncio
from functools 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

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-redux-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

raven_aiohttp_redux-0.1.0-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file raven-aiohttp-redux-0.1.0.tar.gz.

File metadata

  • Download URL: raven-aiohttp-redux-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for raven-aiohttp-redux-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a5c23e4ad9a0978bff6df3830c5ff3053d177448fc9281a1fd1c73f3074ffed4
MD5 8dbafc1cd43518e0da3171c799159940
BLAKE2b-256 d08d8888103b0d2ffa40a7e6f7511a6c36a4686012db09461190f2f0a91271ca

See more details on using hashes here.

File details

Details for the file raven_aiohttp_redux-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for raven_aiohttp_redux-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 900d090143d9ad95d184d7756c43e3a1aa462da90c9612865a3dc558e4cbee55
MD5 8d36fb7e081a60211a82405ad0f8f6a1
BLAKE2b-256 46471bf7570a51f2f83c3c3538bb89e96a19d103be9e8c26955bb826635d1317

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