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.16.1-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.16.1-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.16.1-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.16.1-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.16.1-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.16.1-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.16.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.16.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 57544ddd6875957e48d5c269c54791ad20e526a4400befb0261b9200f7dc0916
MD5 c6b595b7dbc978148417f73b603d3315
BLAKE2b-256 d63827e17ba3f4672fec67a70a158684bfd199b91733349fcdde7ca3657519c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7f2d6aabe483d7be16a7264ec40e578c93121c67ffbc7e882713d148d920dd5e
MD5 738d5cd5358917b575a22ce7ffecd627
BLAKE2b-256 4c7e543a0880f68bd3c00849ff220671ee8afb92ad31994adc7aa40fd9b209bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 946c9d84201b753b632c2c006358dc37623eb7649468a72e183ffb37f1634c85
MD5 e5bad957f7b5965cee404ead141dcd4e
BLAKE2b-256 ae4b4245d3825ce02c037314c0cec42a5ebd38a8933b0ee15377c69d02fb02c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dcaccceace9f4fccaf5a84a0d2dc99afae91d5c1a823925eff88f44133f19666
MD5 9bf3c5e60c216d8b6f9ec0748ccfa1bb
BLAKE2b-256 3944fdc00ba8176e6f841a9231e2f8a4e34ad03359eaed39535e0021cad48ea2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0794aa9f3042f2276a7e063fea6c25b23cb12d855241dff0432fd81fbd2fa494
MD5 321a3486bccdff12896cc1c661e98a5a
BLAKE2b-256 fc21180bc756e3040d3fc50a6e3688a60c7154c91dfdc681e15860330f2cd9cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f61da302244481b5c478870cadb2313ec4a5a56c2d9d353bb55f4df7221e0cb1
MD5 35204412b8b45a9d5c096bba47072128
BLAKE2b-256 b6f11485c2c80592db05404e65811bec0a37d1f28bfbee1941ca1a06b7234594

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