Skip to main content

dbpulse-agent (Python)

Application-layer PostgreSQL query monitoring for Flask, Django, FastAPI, and other Python applications. Queries are timed, correlated with the current HTTP request, buffered, and sent to DBPulse without requiring PostgreSQL monitoring roles.

Supported PostgreSQL drivers

  • psycopg2 — Flask, Django, SQLAlchemy, and raw connections
  • psycopg v3 — sync/async applications and modern Django
  • asyncpg — FastAPI and SQLAlchemy async engines

Install the agent and the driver used by your application:

pip install dbpulse-agent[postgresql]  # psycopg2
pip install dbpulse-agent[psycopg3]    # psycopg v3
pip install dbpulse-agent[asyncpg]     # asyncpg

Initialize DBPulse before creating database connections:

import os
from dbpulse_agent import DBPulseAgent

DBPulseAgent.init(
    api_key=os.environ["DBPULSE_API_KEY"],
    connection_id=os.environ["DBPULSE_CONNECTION_ID"],
    db_type="postgresql",
)

Flask

app = Flask(__name__)
DBPulseAgent.flask_middleware()(app)

Django

Initialize the agent near the top of settings.py, then add:

MIDDLEWARE = [
    "dbpulse_agent.middleware.django_mw.DBPulseDjangoMiddleware",
    # ...
]

FastAPI

app = FastAPI()
app.middleware("http")(DBPulseAgent.fastapi_middleware())

Call DBPulseAgent.shutdown() during application shutdown to flush remaining logs.

Metadata

Release files for dbpulse-agent 1.1.0

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

Source distribution (sdist)

Source distribution for dbpulse-agent 1.1.0
File Size Uploaded
dbpulse_agent-1.1.0.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbpulse-agent 1.1.0
File Interpreter ABI Platform
dbpulse_agent-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / dbpulse_agent-1.1.0.tar.gz

Download URL dbpulse_agent-1.1.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b2fbce69eb34b8437214b57677f5898330e67f12debdb25aab35b07e58c8fc19
BLAKE2b-256 checksum
How to use checksums
e1d6d6661f22d7b804ecf596b2ec4f9659eb8d1976aaeabd7c20a4f4b27d3f98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / dbpulse_agent-1.1.0-py3-none-any.whl

Download URL dbpulse_agent-1.1.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4e727d0243a412631612b874ca82ed4c9f579e5fea1d903c74040cc1bb4e415
BLAKE2b-256 checksum
How to use checksums
10e7f7cf5cfe462627fb2f61a9df7b7a3a59742a731ea5e6a2de3e7bd9fc87c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

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