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.6-cp314-cp314-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.6-cp313-cp313-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.6-cp312-cp312-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.6-cp311-cp311-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.6-cp310-cp310-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

sf_veritas-0.15.6-cp39-cp39-manylinux_2_28_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

File details

Details for the file sf_veritas-0.15.6-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.15.6-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0c6a15d3b1424ce58e9a5f04327ca83193076fd380dd26aed7b295eb14cfb07a
MD5 8fd65104a9f65a7371e703413f330019
BLAKE2b-256 7b81fe6da8e561cfb0fbb3737424768297bff0869a09bfd525497ab5b569ab82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.6-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 714b19e61588761fb77d6ac92a8625c79b0aa22aed6fba58c25e064e82c8849f
MD5 789a664dcd8a56042f15d20160107b45
BLAKE2b-256 875a632b35aec3d115db7bc8a08309adc42174860ce3753cec95920e8709b4a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.6-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c99a1b25fdf7dfafe9356a0b33862439e3c72935b0adde40af24d811fded89d
MD5 8ed095388f0b04b67dae83c921077ada
BLAKE2b-256 06d47aebb9c1c3866f1efc13dc7a489bab2f3f7f103c2c83c78ce1e63818633e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.6-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 78c1a6ca53c2781ed99a9ac7f39a4c96b5d83f2e324397cf3756d7bda2c60651
MD5 b3ed8c0195964f79c45e25a32ebd6510
BLAKE2b-256 8854e8365b2a1241c6890b7b40da4b17b0ce35f5e55cb4faaeac5aafc87de38d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.6-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f35254e88edc446911c33ad903246d5d6cf89b4867f180b8da86c4396d78471e
MD5 7dc9cfa8cfdad7c687c6eec73293f948
BLAKE2b-256 7bd32c1601d9180c2516d88361263aaa44e37d2682987760d6d32621e144f75e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.6-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d06c8e3dff3152752e09170e8f807caae51f8139b6790fa67dd231e84715c21b
MD5 0c47679d2c42a6cec2cacea79a9d7bd6
BLAKE2b-256 bfdc78e31738d33a6897e1ba250e3da3302b24561ea0d55e6ca1c6695fa41d45

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