Skip to main content

The connective tissue of the Seren stack: shared runtime plumbing (request logging now; cluster client / discovery / DTOs later).

Project description

SerenSinew

The connective tissue of the Seren stack.

If SerenMeninges is the membrane - the UI shell, auth, config, credentials every service wears - then Sinew is the tendon: the cross-cutting runtime plumbing every Seren web service repeats. One copy, so a fix lands everywhere at once.

What's in it (today)

Request logging. Drop-in middleware that logs every HTTP request as <client> <METHOD> <path> -> <status> (<ms>ms) - INFO for 2xx/3xx, WARNING for 4xx (and slow 2xx), ERROR with a full traceback for 5xx. Goes to both stderr (so journalctl catches it) and a rotating file the running user owns at ~/seren-logs/<service>-requests.log, so anyone debugging can tail it without sudo.

It's parameterized, not hardcoded - service_name picks the logger name and log filename, env_prefix picks the env-var namespace:

from seren_sinew.request_log import RequestLoggingMiddleware

# Mount OUTERMOST - before auth - so 401s get logged too.
app.add_middleware(BearerAuthMiddleware, expected_token=token)   # inner
app.add_middleware(                                              # outer
    RequestLoggingMiddleware,
    service_name="seren-observatory",
    env_prefix="SEREN_AGENT",   # -> SEREN_AGENT_LOG_LEVEL / SEREN_AGENT_LOG_QUERY
)

Knobs (per env_prefix):

env var effect
<PREFIX>_LOG_LEVEL INFO (default) | DEBUG | WARNING | ERROR
<PREFIX>_LOG_QUERY 1 to append ?query to the logged path (off by default - query strings can carry tokens / PII)

What's coming

The Python landing pad for the cluster client / discovery / DTOs when Lodestar (RuntimeHost) and Workbench port over from C#. Sinew is where the connective runtime code goes; Meninges stays the membrane.

Install

pip install seren-sinew

Light by design - depends only on starlette (already in every leaf via FastAPI), so it stays FastAPI-agnostic and adds nothing to a real install.

GPL-3.0-or-later.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seren_sinew-1.0.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seren_sinew-1.0.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file seren_sinew-1.0.0.tar.gz.

File metadata

  • Download URL: seren_sinew-1.0.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for seren_sinew-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0bb56ad1d76db8cb942f9b500b5a8906afcb9805b366ab6c4d18b14567a51cbb
MD5 31e98a607bbb188e4e51ad31b44e552a
BLAKE2b-256 5b1b1c4ef43e635ad2b6cc99fde0596f20c809de949bd0b0180e3666f4aae2e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for seren_sinew-1.0.0.tar.gz:

Publisher: release.yml on ChadRoesler/SerenSinew

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file seren_sinew-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: seren_sinew-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for seren_sinew-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28dd163a02a6e81b3c4832dcdb1db0f3e51ac8c625948f5264fb8811aae71b59
MD5 0d01eec6a7348a06de13c5e72f5dbfb2
BLAKE2b-256 d45ee0f0c1dc530c36628ea450f7b3765090ad1f01d3306958e31c2494d383ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for seren_sinew-1.0.0-py3-none-any.whl:

Publisher: release.yml on ChadRoesler/SerenSinew

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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