Metadata-Version: 2.1
Name: sentry-sqs-transport
Version: 1.0.0
Summary: SQS Transport for the sentry-sdk
Home-page: https://github.com/terrycain/sentry-sqs-transport
Author: Terry Cain
Author-email: terry@terrys-home.co.uk
License: Apache 2
Keywords: sentry sqs
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
Requires-Dist: boto3
Requires-Dist: sentry-sdk (>=0.12.2)

Sentry SDK SQS Transport
========================

.. image:: https://img.shields.io/pypi/v/sentry_sqs_transport.svg
        :target: https://pypi.python.org/pypi/sentry_sqs_transport

.. image:: https://travis-ci.com/terrycain/sentry-sqs-transport.svg?branch=master
        :target: https://travis-ci.com/terrycain/sentry-sqs-transport

.. image:: https://pyup.io/repos/github/terrycain/sentry-sqs-transport/shield.svg
     :target: https://pyup.io/repos/github/terrycain/sentry-sqs-transport/
     :alt: Updates

Simple AWS SQS sentry-sdk transport that takes ideas from https://github.com/Netflix-Skunkworks/raven-sqs-proxy

It closely follows the HTTPTransport just substituting the HTTP POST section with an SQS Send Message.

Installation
------------

To install:

.. code:: bash

    pip install sentry-sqs-transport

Below is an example of how to use the transport (note the ``transport`` keyword argument).

.. code:: python

    import sentry_sdk
    from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
    from sentry_sqs_transport import SQSTransport

    sentry_sdk.init(
        dsn="https://00000000000000000000000000000000@sentry.example.org/11",
        integrations=[AwsLambdaIntegration()],
        transport=SQSTransport,

        # Optional
        sqs_queue_url='https://sqs.eu-west-2.amazonaws.com/000000000000/SomeQueue',
        sqs_client_kwargs={'region_name': 'us-east-1'}
    )

Configuration
-------------

To configure which SQS queue to use, pass ``sqs_queue_url`` into the SDK init function with the SQS queue url as the value.
You can also set ``SENTRY_SQS_QUEUE_URL`` envrionment variable.

The parameter ``sqs_client_kwargs`` should be a dictionary and will be passed into the boto3 client
like ``boto3.client('sqs', **sqs_client_kwargs)``.

SQS Message Format
------------------

The format of the message that is put on an SQS queue is a JSON payload which looks like the example below. The body is a
base64'd form of what the SDK would usually post, which is also gzipped.

.. code:: json

    {
      "method": "POST",
      "headers": {
        "User-Agent": "string",
        "X-Sentry-Auth": "string",
        "Content-Type": "application/json",
        "Content-Encoding": "gzip",
      },
      "url": "https://sentry.example/org",
      "body": "base64 string"
    }

Sentry SQS Consumer
-------------------

In the ``resources`` folder there is a simple lambda function that will consume these sentry events off the SQS queue and send them to sentry.

TODO
----

- Add tests


