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

File metadata

File hashes

Hashes for sf_veritas-0.15.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a75a71e3cd87f2d16e64d7f5cc2576585bbefb6cfc7fecf40b2b92d72bce629f
MD5 10ac1eb68268350040d2c1cf95b36d13
BLAKE2b-256 62ab213dad543665b818ccb23199ad6f149544cda6115c7233c5327dd1b44515

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6db8dc57b2fef8a7bd856ad202bb2a1fd94608d6d231584175f2201241489450
MD5 d4fb7a34fbe982fa2660280b42a146d4
BLAKE2b-256 b96334a9381290019f924b013a871ce08d87dc32d6f805ef1766ee70af2aab9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 324102415789dd5a838ac6719be963c12337ecb119cf96d254d9f712c7c1e988
MD5 aeed8764280587854362ec8c8763f76b
BLAKE2b-256 92b78244f7bdde8a125aac63c1f97313f6ad90481acd96ab6410813cf9c383ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd4b61975e48d32cae8916d58cec1c60dc8fc283000e3bdb28fcd8d22b668bdd
MD5 508a3c732d03abaf1726d00852d35466
BLAKE2b-256 0df86e8b6143a13fe0ca0b04128023f63bc5858fb43965a15d4a65c304b48240

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e859d258e65021144d4f070eb393ae387fe9c681d2382b15720d745279da43f
MD5 7edb601a36fe0e3b324a2e177a0a6913
BLAKE2b-256 cfd5bebea9b260588978417d5b126cffd64e5947af3fef0018a875d025982613

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 765a2e2862c8a5e485636eb433528df1db49d10dddbedf0ece18e37d99fb801a
MD5 8dd15f5619d27a94972ea0a21f6fffe3
BLAKE2b-256 e2b2a630ec7f212d74cba49ac13886cf59c99e7fd2106467f3f4aefaa7121e2e

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