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

File metadata

File hashes

Hashes for sf_veritas-0.15.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb029338bce7f5d827b3181a780ebd958b304d8774e71bb65e6539af2fac8266
MD5 55dacf299c772caf3613391a26be0fe4
BLAKE2b-256 3caff047073435e7407660e7ef6272590fd954618dccbbbc87bfe36b9002a83e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 26cdac154e75a63c6579a320d1210490714999a1d8df1b72a351e381d1ff8627
MD5 43458ff63515102d839937d0200bb4e5
BLAKE2b-256 d2e56eb7751b7ef0ba7b5cdeaf619c6d53e68997d9a746b86022057426e51504

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad06ab03fc9e0e868ef358322da97896ccd3081835ac76bd3ee245bacafe0b6c
MD5 b821039cca2f24d26a6e8e51895456ae
BLAKE2b-256 72497468e519585b7d41d7e683ba68c96015afa1099bf75dfe8917a6360ddc6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6ebe40a89bedbc149478dd0a4c85d92155d3f95b32936a740ecbcddea696b5a0
MD5 bb7804cba507fa0e9c765f72d854d5a4
BLAKE2b-256 1c987082935c04ac04fdf46d5b77080e4eab39330032ed04603fc952393446db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 26ef08714b024a3ecd4a99262608c3f3c25d7d67726bd8dc1aac35336043e5c5
MD5 5bdb17cb53eb88cf62d3433edbac9895
BLAKE2b-256 421dc9872d504ec8f67e12ac593b8012499f11a9841f56a7cb68c04a76d99595

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 375906535731cb7d0683ab10288e2ca06e2876a36983973955fa1e0c82deed5f
MD5 fb9bfbf9b5e190ade75f648463caa03b
BLAKE2b-256 642b673a057661ea5c7e0efe45d978953c253ec9e84e120d799c6d8cb00817f5

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