Instrument asyncio Python for AWS X-Ray.
Project description
xraysink (aka xray-asyncio)
Extra AWS X-Ray instrumentation for asyncio Python libraries that are not (yet) supported by the official aws_xray_sdk library.
Integrations Supported
- Generic ASGI-compatible tracing middleware for any ASGI-compliant web framework. This has been tested with:
Installation
xraysink is distributed as a standard python package through pypi, so you can install it with your favourite Python package manager. For example:
pip install xraysink
How to use
FastAPI
Instrument incoming requests in your FastAPI web server by adding the xray_middleware
. For example:
# Basic asyncio X-Ray configuration
xray_recorder.configure(context=AsyncContext(), service="my-cute-little-service")
# Create a FastAPI app with various middleware
app = FastAPI()
app.add_middleware(MyTracingDependentMiddleware) # Any middleware that is added earlier will have the X-Ray tracing context available to it
app.add_middleware(BaseHTTPMiddleware, dispatch=xray_middleware)
Licence
This project uses the Apache 2.0 licence, to make it compatible with aws_xray_sdk, the primary library for integrating with AWS X-Ray.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xraysink-1.0.0.tar.gz
(9.3 kB
view hashes)