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.1

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.1
File Size Uploaded Provenance
asynclens-0.1.1.tar.gz 13.3 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for asynclens 0.1.1
File
asynclens-0.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
asynclens-0.1.1-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.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
asynclens-0.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
asynclens-0.1.1-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.1.tar.gz

Download URL asynclens-0.1.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dc682fd2d80fa842fd1b4e0cd27cf86c3de934fde1f44205ac612b297ae98731
BLAKE2b-256 checksum
How to use checksums
6b0dc729a4eb1191b27c7cabfa40baf0e0b31f8cc8f6b15a73041f1712b69fb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

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

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

Download URL asynclens-0.1.1-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
6b9f7f78f632f599b59eaee6a5680e33149ba0145441ad49c78b7d16dd90e468
BLAKE2b-256 checksum
How to use checksums
23ba22e8398fb70f54d8e9f2f43a97225a801a47227434ff44959223f5772925
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL asynclens-0.1.1-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
cd6b5b6727b1f993c47fb3b2bef5f07dfc62db633f9b0f6bd2713bff37f5f859
BLAKE2b-256 checksum
How to use checksums
ba1b69b18602f1ce2a068cbae3e66b65176e6db406fd1e00fc9c637fcaa0eb72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL asynclens-0.1.1-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
0c17477cc50510e8e766cc9871a4454b3de631db4e6b3a324df01356434b104f
BLAKE2b-256 checksum
How to use checksums
35e85d1e982e3cad6f5170b146411e152c0bb7d03ba3db7e93b9c6fac47dd75d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

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

Download URL asynclens-0.1.1-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
165a96f56a417caebe7316b5f087aef04a22a1379763df1b6cb1ab3698bf2a53
BLAKE2b-256 checksum
How to use checksums
eb00572e777c77b0b700ffba66503ee59fe7ac123cd52166f6a5e6b5c662e505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.15.0

Security for asynclens 0.1.1

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