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

File metadata

File hashes

Hashes for sf_veritas-0.15.3-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f0b5afcddc004d17c41279a3d307e9cf095484e9729e03015f35de4cb2d4bc95
MD5 ea2440464a306d6b6e7623d39667fd5d
BLAKE2b-256 f08bc93c611e7b939a375bc07425da13247ec54786550e1eb78e76c713a88fd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 54272e1170c79647c867929fcda6846307b87a20ede2f6e0eb1cd34c8f9fb38a
MD5 f8fcec38b189ae733e1e79d22a73c3ec
BLAKE2b-256 64ad1e72a2168fa8672e2265933795fb3b53edb3c43c14ee5796a60eec210d8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6881a5ee426f306a8837c543d2890c7f5055a7221ef81a81f4d604d904affc01
MD5 6685d14efa458fe2ddd3283c2a2cbeff
BLAKE2b-256 8eb150a2ae6c34e860e8bfa875915fa190ab299e6de684de7d9e1cb3a3dd9e9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cef1a41090414f630be1bd76bc2efe07f322d65dc0a82c76ecd3712a47d8872c
MD5 a3b8719e04ace90a7884ba0e35944828
BLAKE2b-256 c8a017546080b23ac5fbf4820f2cfa6410ecd74867c99404c3d6358238fe06f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 35999a511409477b508157bb15ec5b3ddf591bb58b060ef6afab8c05f7c8bcd0
MD5 fffe9357658c2ad0669a0960848543b7
BLAKE2b-256 f27c0cc5b7b4bdc305ef199ae2806b88462cd339de1e0ba54ccca6866e6f615b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f8b468f666047551838015155e97a0d2d7afa835eda27a8dbd5483e23eaefec
MD5 fca3553b7e3c978ad5b32eacf299c4ce
BLAKE2b-256 070668d9a0601eb527790cd0641655855fb0f526b493a56aca1101f78fecb038

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