Sentry SDK SQS Transport
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:
pip install sentry-sqs-transport
Below is an example of how to use the transport (note the transport keyword argument).
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.
{
"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
Metadata
Release files for sentry-sqs-transport 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sentry-sqs-transport-1.0.1.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentry_sqs_transport-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.0 kB
Release files / sentry-sqs-transport-1.0.1.tar.gz
| Download URL | sentry-sqs-transport-1.0.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc95acb1a5b2a483d7474c1b51a53d015201fa1fa8a0c90988c917d2eef9639d
|
|
BLAKE2b-256 checksum How to use checksums |
56c8580cecd99946e7e2306530ae53c769d99f6011c658f3e2f378a468985ab1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1
|
Release files / sentry_sqs_transport-1.0.1-py3-none-any.whl
| Download URL | sentry_sqs_transport-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab9b710d2597ecbd71de91a6d148807a8f4eecfc9f82c8b2f98420d1fc9024d6
|
|
BLAKE2b-256 checksum How to use checksums |
d34696f9a6e49a204ce92b99636005d6093af8c707925d80b365bcfa687740be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1
|