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

File metadata

File hashes

Hashes for sf_veritas-0.14.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 10952a7d8161f9e33e458ae3641794142d71054e9fd40b4ac2619ed90bda095e
MD5 f6bcb2d0f26361e674395f1b92a5f6f2
BLAKE2b-256 e5dccff8984d192e42fe4a481924d6357a7b4e7d1d83d6f0889c9770fdd0f693

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.14.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6fa2ddb5538a02a9637d4178ab116630a88132166172cbef92f1edf8e5a7ab22
MD5 dc340eb19362293ec909069f5cb807bf
BLAKE2b-256 5e557449974971b48c707ae449d3c1db353f152829a2fd619de8ffaeff28fea2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.14.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b67df10a04686f2980e5d338d2aadcb3eb2cb682d1f5485148c72114a72d2a17
MD5 d7694c836c9a910ff68f39ab78414673
BLAKE2b-256 5c442ea010a3cf1e3be870f1bb032c264f0097e5cb9b7e3c8ca82b83e8c9aa38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.14.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3f1e589e2d4573405d00290d51f9eab361c596185e730b22815cad147ef6e708
MD5 216c87d15575eac3a85abfbfce907381
BLAKE2b-256 2bb0f2c9473d5b6e2d7a6d3f64b79cd230490c1cbb12940b42ec3ba7593608ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.14.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3bfdfc7c225face4ae9cbeecac93311bb748f72a4e947fe7333754248023c637
MD5 4b4afb26190df0792697413364a289d0
BLAKE2b-256 d307fabb07d51e729013a39716136436cfc21f4817bdfd56db9489474ed55752

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.14.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6560d77c7d5a657c2940348e67d209b2e1dac50f18aefb4ab7a8dc1ec718dd9f
MD5 065c52abfb37160c26f3532f60824083
BLAKE2b-256 6139699904f3f5af8d3b1738079c817669d47d3551d060f605181c088cd87110

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