Skip to main content

Middleware for Django, Flask, and FastAPI to intercept requests, logs, and exceptions.

Project description

SF3 Middleware - Currently transmissions are diabled

Middleware for Python (Django, Flask, and FastAPI) to intercept requests, print statements, logs, and exceptions while persisting tracing.

Installation

Use Poetry to install:

poetry add sf-veritas

Usage

Django, etc

Switch the following:

python manage.py runserver 0.0.0.0:8000

To:

sf-veritas API-KEY python manage.py runserver 0.0.0.0:8000

TODO - Rename all Sailfish artifacts to Sailfish.ai

Debug Mode

Sailfish supports a server-triggered debug mode that turns on full function-span capture (arguments, return values, timings) for a time-bounded, budget-bounded window — for live backend services that have no HTTP surface (Celery workers, Kafka consumers, cron jobs).

A daemon thread holds a WebSocket connection to the Sailfish backend. When the UI enables debug for a service identifier, the rule list is broadcast to every pod of that service simultaneously via Redis pub/sub on the backend, applied through a process-wide override on the C profiler's hot path. Capture stops when TTL expires, span budget is exhausted, byte budget is exhausted, or the UI cancels.

Disable via SF_DEBUG_MODE_DISABLED=true. See docs/docs-enterprise/debug-mode.md for the full user-facing description, rule schema, and limitations.

Network Hop Calculation Time

To evaluate the performance impact of this package, we benchmarked 1000 HTTP requests with and without the package enabled.

Configuration Mean (ms) Median (ms) Std Dev (ms)
✅ With Package 79.12 54.00 111.18
❌ Without Package 69.70 52.00 73.78

⚠️ Note: The package introduces a slight increase in mean response time and variance. This trade-off may be acceptable depending on the value the package provides (e.g., additional logging, monitoring, or security features).


Optimized Entrypoint Capture (Post-Refactor)

After optimizing how the user-code entrypoint is captured (via faster stack inspection), we observed improved stability and performance across 1015 analyzed requests:

Configuration Mean (ms) Median (ms) Std Dev (ms)
✅ With Package 142.45 138.50 80.78
❌ Without Package 131.07 127.00 35.75

⚠️ The optimized implementation added a slight increase in mean latency (~8.7%), but this tradeoff is offset by improved accuracy of entrypoint capture.


Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

sf_veritas-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

sf_veritas-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

sf_veritas-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

sf_veritas-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

sf_veritas-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

sf_veritas-0.14.0-cp39-cp39-manylinux_2_28_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

File details

Details for the file sf_veritas-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c73c37208cf5b040281358dbfa7feffdf3d2d8a184f70f4998556ddf61821754
MD5 62e53e52fda474531ce15970cccea5b7
BLAKE2b-256 b9cf24aae7851a0015a2e6494167b7c94ba93c78a8f9499fac7159e387207f2f

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e5ae870ac98174df980336665c12f766882647d5fdf1c1804a334056f085166
MD5 d60c313471e731ea7dc6364fc02c7dae
BLAKE2b-256 8116d4e479f28e36ad96ec189e821ff7acbadeddea3e035a239ae24de55cbb61

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e4d58ac1b38794e240bc593979679e25229adc983d18ccc85ec2a8a559206f8d
MD5 3d897a05e090611c95d95a2cfd77c1dc
BLAKE2b-256 f823c6e6a09a5cb4515bf195597db92eb974a330caed991e209b0c01c7cd8d59

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 67ec0983f2142783c9132be13a5926262b47c2140e0fd6d603c28a8f859fa3d4
MD5 4444ec786afead581b3ea3ad032bc5f8
BLAKE2b-256 0832728925fb73c3c4e276f419fd251816c4675392af97c2a4111ed43afa3924

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 907173c3ffc8e12d20734e0093bc9f062ed650e09642596e795d3d591c148118
MD5 2295434c51b3d155917f8a43a5e61084
BLAKE2b-256 cfb08edbe73d07863d1d9b1dc903eecdbc16458363a72760356fe982d886d73d

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ae3cec5b6c6cfc3d68a72ad8a661002346d6ab9630e88d515b0bc64f6707c003
MD5 29f87c67405290d762e24a75027ba560
BLAKE2b-256 d1fbc5d25bd4c6d6b60ad14d7245167ed1f996e7d40d14b4783c385abc455d43

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