Skip to main content

AsyncLens ⚡

An ultra-performant, low-overhead native event loop watchdog for Python Asyncio and AnyIO applications, powered by a fast Rust core.

AsyncLens detects silent event loop starvation in production environments—such as when a misplaced synchronous blocking call (time.sleep(), heavy mathematical computations, or a non-async database driver) paralyzes your execution thread—and isolates the exact offending lines of code instantly.

Why AsyncLens?

  • Zero-Cost Abstraction: Built on PyO3 and native Rust atomic synchronization primitives (AtomicBool with Ordering::Relaxed).
  • No GIL Contention: The monitoring watchdog executes on an isolated native OS thread entirely outside the Python execution path, preserving microsecond-level runtime performance.
  • Production Deduplication: Implements a deterministic state machine to group cascading thread freezes into a single, clean timeline block. It fires a single alert when the loop stalls and a single recovery update when traffic resumes—eliminating alert fatigue and log storming.
  • Lean Architecture: Distributed with zero unnecessary dependencies. Standard asyncio loop handling is fully self-contained, while anyio support lives in a separate, isolated import module.
  • Framework Agnostic: Seamlessly integrates with raw async scripts, background task workers (Celery, Arq), or modern web frameworks like FastAPI and Starlette via standard lifecycle context managers.

Getting started

Install AsyncLens with pip install asynclens or uv add asynclens

Quick example with FastAPI

Copy and paste the following code in a file named api.py

import asyncio
import logging
import time

from contextlib import asynccontextmanager

from asynclens import AsyncWatchdog
from fastapi import FastAPI

logger = logging.getLogger("uvicorn.error")

@asynccontextmanager
async def lifespan(app: FastAPI):
    async with AsyncWatchdog(threshold_ms=50, logger=logger):
        yield

app = FastAPI(lifespan=lifespan)

@app.get("/good-async")
async def good():
    await asyncio.sleep(0.5)
    return {"ok": "done"}


@app.get("/bad-async")
async def slow():
    time.sleep(0.5)
    return {"ok": "done"}


if __name__ == "__main__":
    import uvicorn
    uvicorn.run("api:app", reload=False, workers=4)

🚀 Need Distributed Production Alerts?

The core engine runs entirely locally inside your application logs. If you need real-time Slack/Discord notifications, cloud ingestion pipelines, or a centralized performance dashboard for multi-worker production clusters, Join the AsyncLens Pro Waitlist ↗.

Metadata

Release files for asynclens 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asynclens 0.1.2
File Size Uploaded Provenance
asynclens-0.1.2.tar.gz 13.4 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for asynclens 0.1.2
File
asynclens-0.1.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
asynclens-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
asynclens-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
asynclens-0.1.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
asynclens-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 944.2 kB

Release files / asynclens-0.1.2.tar.gz

Download URL asynclens-0.1.2.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
105a0de9d2a0c3f2700a151016bee505e8e12aa3c4f5a0efc7c6d63c5497580e
BLAKE2b-256 checksum
How to use checksums
9393cac1f2361b6645775f3d0f7f025beca2824bb16b024237a6c437e23dc92b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / asynclens-0.1.2-cp39-abi3-win_amd64.whl

Download URL asynclens-0.1.2-cp39-abi3-win_amd64.whl
Size 123.4 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
455eabf57c3d1fd7029b11abb250e5526008e59fb505031b9ee58ff56cdc1b1b
BLAKE2b-256 checksum
How to use checksums
e05811d6dc771f2c88e15addd7a96589b5b05ad565d2ddf42801698c98cedac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / asynclens-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL asynclens-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 211.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
94e1c3626bc611ba7a3fb7465aa0831fe3ef40978080f37a8c1b6af0933e51f2
BLAKE2b-256 checksum
How to use checksums
706ddaef6d9552affe635b71085f2ab1f5c92e0e3204b0f84de75934d6adee68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / asynclens-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL asynclens-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 205.2 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e192c2d710a7de7f24c57a1fd86881b9251abae4f70c13720c8c32d79d545069
BLAKE2b-256 checksum
How to use checksums
5ee3eb9f55f9b01ea2bccbab90bc225c28741826878f8aedb89f30e55d826647
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / asynclens-0.1.2-cp39-abi3-macosx_11_0_arm64.whl

Download URL asynclens-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Size 191.3 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
316cfbbe2d3d304cc1da6c6ac3cd4dee97aad7295a5436b606d0a317f1421a70
BLAKE2b-256 checksum
How to use checksums
d13d8060296ac1e3b0e3f3e32f6631a096f43631483a5ff4c59eb9a6fadb84bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Release files / asynclens-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl

Download URL asynclens-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
Size 199.9 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
297a8f6f977b529c9d7ec4a386e4ac2370d156bb6b23133d33a5dff6b938d423
BLAKE2b-256 checksum
How to use checksums
259fa066f623f71de093dcdc302a900562c897ca49aaf6c9377c89b14cffd572
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Security for asynclens 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page