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

File metadata

File hashes

Hashes for sf_veritas-0.15.2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 85e5d71896b504886d2970fefb540c69424a139df5510f2d9e38b936a41d2848
MD5 859be5a444a949a87b78f857b9f67b68
BLAKE2b-256 01811646ed6e28b12c2dfc7693e35d04dd48bb04623e5fa86e1a432a68d71464

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3d714fd1f79d914a08980b4bac01d8d4bb4a6f943b3e0ae3b3ff40fa7eb7ce7f
MD5 4b334b05cd862dac1129a1922cb5bf2f
BLAKE2b-256 06c95b3028517fdcbbae536fad2e5d54887ef16fc355a1ef7b3b050ecc615be0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b7a8c71555194380de8159359191e4ffa3f22b7375afbf00df17e0c85540dd3e
MD5 e5529e17a456a5b8bcf0385bce1c83c0
BLAKE2b-256 6f1fd52aa19effc4b4b401769b0e191e933670c900da207e09a6ef57b6947245

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4c12b730b1ac3c35391ba36758919c621a49ced8a9da735c14b81d4b054c2985
MD5 5b1679111ffff2df93d4d19932fbc93f
BLAKE2b-256 f632126743a8d2f97e100654ff171ec25d58ea28f23173c1c87812d830057ac8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5effb0df8992f8e25fe846a2220fc5989e535930ed26514f37dcc75a869ed188
MD5 c2943366b7ec3cd9ee1210a2317cca46
BLAKE2b-256 7fd9e646cb40c1bc7e40972da6e5b7ae9ac7f53d4111e3cffe7b800a2504b47d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 54e389566b7134a246c4711918136f9b2f9b894fc728bade0d18cb02f3689740
MD5 6de2f84ba60d7f99dd6daa531582bf02
BLAKE2b-256 f5772aef3c648fdeee643a800b0a62b4aab96dbe8e82963cd359808b36ecbe23

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