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.15.9-cp314-cp314-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.9-cp313-cp313-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.9-cp312-cp312-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.9-cp311-cp311-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.9-cp310-cp310-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.9-cp39-cp39-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.9-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ed06315a8ffa035442f47b42d43bb8eff0c0a43d0974f228a90d9051b62878aa
MD5 c189f3b95e662f8510030fb2946b65e5
BLAKE2b-256 bf06e8250e419a0aa38d3055820e58c3e8fb59f8137ac43081e77235d7a565d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.9-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9254ede1c73984bdcb4752914e500c4cd24bf5cfb35108b887b1ed28170c7978
MD5 faa2100ae2f640955b4515c1d9a48ef1
BLAKE2b-256 26bb3f8bde10b16736cb22f02b607fc3bd1247d544a828dae20b2e7800b14759

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.9-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0f40ee40002a2ef44ba0b3a2c9fc34589bc7a6c5ba02649c449938ab0970522f
MD5 1cad6ca45be87227edd4144521287c4e
BLAKE2b-256 e8b4070cef9dc5f8af38401ba9d5e80b4848e8399b4e70a7c4ea32ce14b92b68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.9-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 affa511716a00a890f68ce579376a2327664fddc30cfaf2f3871ca03edd3470d
MD5 441df63a22a3b9b111f213adaf5397a3
BLAKE2b-256 ed515e96097f30036b1d04b309bef0ac3f8a6c44f266ad3ff304770a9b2f7fd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.9-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 57036cbad6cb6fd88ae99a0425726396e736e5872113ba62185a89cd0eb2efa2
MD5 a7212af723aee06dc025dfd1c2f85ede
BLAKE2b-256 68849c93401f706db6a428b9fef0c956bdbe84094788df632ed1774e7c48a97c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.9-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d236ba69a8b7414407561c13feef57d59400fba484839e6df1fb35fb23a795e
MD5 3bb69236dd1d334cf71423ad2ed88a6f
BLAKE2b-256 dc79c439f7a19253c24c67520bd1381bb9fc7f2ee5d658c453209f0fe3739d56

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