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

File metadata

File hashes

Hashes for sf_veritas-0.14.0a0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dad5e9ff244b665be72dd0a89d3a09a5f5df1f1affc1cb5da0bce1eecd1d0f73
MD5 59802938ad170dba0cd1671edfc12f51
BLAKE2b-256 15c6b6a87ef90df5b3f1a2a9dd14595966532ec9970b6f88276347b0370cd89f

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0a0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0a0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e910f2ce335de846a929134643683bac92b7993cc13fb066975a2ad7e8f2ddc8
MD5 a8ec1d437213d2f48eeebae629c94e15
BLAKE2b-256 04b432584bb808e38b8a27e8c7cc7930d95ae53c7f8a6667be99c754f61dbc90

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0a0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0a0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9a10319b96841c4693fea946847f300ab46359724e01f6ed65a3cec242ac80a2
MD5 dab2cf7c349d5bd636667ede13555aa6
BLAKE2b-256 4ad0bd19c580989fdde3c723459723d5f646486dca96b224624b24d2b8de4145

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0a0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0a0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7539d6c65f2bc65d3c3a38f9e9cf2cd656a8df1a179a5c7f74e05eba27f2ca0f
MD5 92ccf25be9a12332f77495464e72019c
BLAKE2b-256 f01fc697b20876ae0a7b37d8b3afc802947ae395c30d1109ffaf61536efe1854

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0a0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0a0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c06177afd7562ef725a1dab6f043cfdfdc87b1091b9f664b7bc6c1060117f635
MD5 51efdede702fbf4822a3c3d14a100cb6
BLAKE2b-256 252a0a18e7db2634b5de14ffdab23007046bd19176d5f3ba887ef6b27b01507e

See more details on using hashes here.

File details

Details for the file sf_veritas-0.14.0a0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sf_veritas-0.14.0a0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3b2f36fbe9f4e24eaf8ceb9f14066b314e2ee8e0691b16b2c0a80a35c9c7ec91
MD5 a402c0da60a47ce748a0580340e11ecb
BLAKE2b-256 18d7b29d096b1db43120299a58a06eb5ecc2a5934cdb2ea15076c728f3601b0a

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