Skip to main content

Lightweight database query capture agent for DBPulse — real-time monitoring for PostgreSQL, MySQL, and MongoDB

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbpulse_agent-1.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbpulse_agent-1.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file dbpulse_agent-1.1.0.tar.gz.

File metadata

  • Download URL: dbpulse_agent-1.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for dbpulse_agent-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b2fbce69eb34b8437214b57677f5898330e67f12debdb25aab35b07e58c8fc19
MD5 c89db99de6cb9ba6f43b6b36703cdf3c
BLAKE2b-256 e1d6d6661f22d7b804ecf596b2ec4f9659eb8d1976aaeabd7c20a4f4b27d3f98

See more details on using hashes here.

File details

Details for the file dbpulse_agent-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: dbpulse_agent-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for dbpulse_agent-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4e727d0243a412631612b874ca82ed4c9f579e5fea1d903c74040cc1bb4e415
MD5 ab7629185ec96a8d99a650f0e2137789
BLAKE2b-256 10e7f7cf5cfe462627fb2f61a9df7b7a3a59742a731ea5e6a2de3e7bd9fc87c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page