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

File metadata

File hashes

Hashes for sf_veritas-0.15.4-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa7bac915f025a68515fcae11f540df4f09114135ac182fbef03db2bb210ea2e
MD5 c4e3d200c7db00f6ab11b027a70032b1
BLAKE2b-256 55c61d637eb74ee534d3baed3b41cba2596f0385bfdcb56f3ca0f074c8d52c45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.4-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 01d686baf93eb7f3599949208165ce1b01f8cb485a6324a64921902ea2fa2307
MD5 595f27c3a16d77d0f2899f3cc13b9bfe
BLAKE2b-256 d91b9eb51b37496ef66dcc82ef57940a806dbcaf0171dedd19797a6f2ad66834

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.4-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5485eb039021b498b79d780f3a73f0ef36842c61aeea38255585541519bbc3c9
MD5 00d7c1a0c4a68f79838d90921aac2810
BLAKE2b-256 1dbe7784769dc99375f1419652113a11dc9a394aef38902a9249c760bf554201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.4-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4004a4dfd77a5e3f899857b00615ca67597fee00a2bc374e79843ad9344f80f6
MD5 3f1c549ae72bb3776c61332a6c7a8dc0
BLAKE2b-256 7b1407b0de51d6e423f52b445ebb57453d2a72fdc3b62d00ed7e73e490407c2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.4-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8879576e87f336864396faf5186dec99d01e8cb93efa6acb85605aedf0b8867c
MD5 9e7b3394ff9f16c696735fe6b305fb45
BLAKE2b-256 36383cdd0c68e01a9f705fed0325135102c0ecc23717ad955c2db93e81cdadef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sf_veritas-0.15.4-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7aabc6c166c304321dc2cc8e1ebf9b0b1c7eef04ce5467a18ac42de6ed23576b
MD5 c6885eff6e809858e6dcaae9b4a443b6
BLAKE2b-256 05264c6acfad2e6e79149b2ba709b84ac5cfa418e8f50793315ffb502054fbf4

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