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

File metadata

File hashes

Hashes for sf_veritas-0.15.5-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b0ae99e3de21b83c2b170f3f629510da1ea154b15de990c369c7348e192a1838
MD5 9bf0b8a42acb200bbaa9e9f88dd77c24
BLAKE2b-256 1fc31858b591d2d7b567b2043b595c9ddac8850d8a9fd8e258cf7403265b7efa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.5-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 61f72a8676082870b9c8bf871cf56a4660a57b6f17a64a0ef9be4045a458bb7d
MD5 f768f3a34b8fe01cb098f198a076f517
BLAKE2b-256 c14ac651b7797d54f53f19269decd84efac34d697e93c5df3a6d22b628c90118

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c2388cd80fe9258e84ffce9cb034635c6de93917a5bd773996688a081c3d6b5c
MD5 5a3e15c652c3bdfc416eaf8e995a2d47
BLAKE2b-256 97e609aec3b55050eace57fc5d55c93d991ebfca39e8a83eb8177c3d632468e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.5-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 88c5b9a65d33e8c36334cfe0e3637e06025d335895ec91dbe03a2756bd004e07
MD5 97d83fbe91e56da709f231f9ad50b869
BLAKE2b-256 dc81890b675245e9c96e649fffdcdfeb87d9a6f5b4ef734e83067f23f4036aa5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.5-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c82e17a68d9f6fe9b73f36144a6bfeff6f821bd12be1d5e97583a194864d8923
MD5 f54416e2c235352aa0ac5e84fc606237
BLAKE2b-256 a15973a86f641edde0285f1737b738aa287a77b653034efa13ad38830d8fd71b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.5-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2898cc9be4f28e33a397c14b8ab893e74f36e8cf80acadb17fd30d8ddf74facf
MD5 de4a613553589eddd2a01a27e9ebe2b2
BLAKE2b-256 d9b319bb81dd110c3be1cba0be26f205f5355e36bd6278e9df3cb330a0bddcc9

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