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

File metadata

File hashes

Hashes for sf_veritas-0.15.8-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e23a7d0895b0078fe6953377013238a39eb04b3976bd724e27175c409d6320d
MD5 f75e692336348cf7d2f7b6c902e1b17a
BLAKE2b-256 c2100f3de50b66ef7c6dc1b94e9244dc63a8ec49c736402ccf6153b48771925f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.8-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c94180d26aab72df9359cc694ff901ca43210521d6a53d9491aaa6b67bd28cc2
MD5 32209b207689a3b788c6ccbdc6e8f1e0
BLAKE2b-256 49a03266ea6d4b30da022433fafbb7de14084262ed11e3ebeeacb827ab8950ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.8-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 289c9674ac459a874054865d7511c4a8a2b2073f7d322b6702aa4b72d4f01c79
MD5 55199be3eb7a593e0e31383e4667d22e
BLAKE2b-256 874d606c4a7cd554e5345df599973e3891e2f1af001085b1a2c24eafe37f9208

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.8-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad4d64afb374bb0fa997997903c724fe7c4a81643b6a7940852b86aef9d32ca5
MD5 259528955e423afc3b8b0fa6c5d5fec8
BLAKE2b-256 ebf5891d82f054f8be38378f82720e7c6a1e9d54b6886f5754a27dc51e5f0d9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.8-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b5b349a0913c0700b38c1fc83138fb1e5f00fc7809e494c292ee81eb7ee18175
MD5 c3972f55690b2369159402773b8e35a5
BLAKE2b-256 1bc3037c87ed4d1efff017c6e67c43692503e241b1191211a0ea16b9842e6f17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.8-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a57ee00daf9af3cb4c99be64fa4717f6a7621b52d028bb878c194b620e24ca9
MD5 fc2df9c7ae73787e3e4f2ec519cdc49a
BLAKE2b-256 89e6bac14c3a2f9af64c94685717709ae63327525a9768d2e21c8a8d9f04a45c

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