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

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

sf_veritas-0.16.0-cp313-cp313-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

sf_veritas-0.16.0-cp312-cp312-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

sf_veritas-0.16.0-cp311-cp311-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

sf_veritas-0.16.0-cp310-cp310-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

sf_veritas-0.16.0-cp39-cp39-manylinux_2_28_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 47552641cdf5849372da1d8a61a581709e647472613c1656bd2cf81670ee0afe
MD5 1f9290615e45537da0e5c93c594a8a2a
BLAKE2b-256 43e9578b20ab3757b965ba4922b721ce0f40fa18dff05f6ed77393691888ac98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 48128feb28430c8afc86b49fcea881feccf0c889f40f7e598adf9833c1faf61d
MD5 6e72c42cb444f1e4e41d55875d4d974b
BLAKE2b-256 a5cd484af1ed5e220c8d4fe1b3b96fdad97e84a209d0fbbf2da2811697813a7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 61c9726f5f5b890048f28422f8dff9fc8de43f215e17538b7d6e5ecddc095956
MD5 409cc89c55a02314566ed4018511ab4d
BLAKE2b-256 41b66c781e5691a72c7f7b92056c09b7d066cbff471ed9f3f4fc77457cf181d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c05db854cc75644f5aef154851f14a26dbdf52537f0cf4bcec8783a5eb3c402
MD5 ade4d2a740b6a09160186de2d2b11796
BLAKE2b-256 8b77e130a446677ae8ca8b7ca4584015f2f300ef1e5808d505813e9141eee563

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3a7394a4d8c16abe9b2a5ae6ebeef1168f3bfe2f0857725e48cf71d928cfec39
MD5 ac1c008c1e27ff153dd429729fe132ca
BLAKE2b-256 edc8c969d94064f37157ef4184ee552d0c6831108f6864c52005fd3280d517a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.16.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c95c172e6fc5b84c72aa496a5306bab3fab567d25a60096f9be3c000f879541e
MD5 0437681ee37a2af42d687b405b9df2d7
BLAKE2b-256 422e8d0b761587dc52a1f8c05b17892462f88f37e19e169692014214016d5147

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