Skip to main content

Official Python SDK for AllStak — error tracking, structured logs, HTTP + DB monitoring, distributed tracing, and cron monitoring with first-class FastAPI, Django and Flask support

Project description

allstak

PyPI Python versions License: MIT CI

AllStak SDK for Python, Django, Flask, FastAPI, and plain services. Captures exceptions, logs, inbound and outbound HTTP requests, spans, database telemetry, and cron heartbeats.

Install

pip install allstak

Framework extras are opt-in so the base install stays minimal:

pip install "allstak[fastapi]"     # FastAPI/Starlette helpers
pip install "allstak[flask]"       # Flask helpers
pip install "allstak[django]"      # Django middleware + integrations
pip install "allstak[sqlalchemy]"  # SQLAlchemy query telemetry
pip install "allstak[all]"         # everything above

Requires Python 3.9+. Wheels are universal (py3-none-any). Every release is built reproducibly under a pinned SOURCE_DATE_EPOCH, validated via twine check --strict, smoke-installed on Python 3.10/3.11/3.12, and uploaded via PyPI Trusted Publishers (OIDC) with PEP 740 Sigstore attestations.

Setup

import os
import allstak

allstak.init(
    api_key=os.getenv("ALLSTAK_API_KEY"),
    environment=os.getenv("APP_ENV", "production"),
    release=os.getenv("ALLSTAK_RELEASE"),
)

allstak.log.info("worker started")
allstak.capture_exception(RuntimeError("checkout failed"))

FastAPI

After allstak.init(...), FastAPI / Starlette apps are auto-instrumented — no extra line needed:

import allstak
from fastapi import FastAPI

allstak.init(api_key="ask_live_...")

app = FastAPI()  # inbound request telemetry + error capture are already wired

To attach explicitly (or to set a service name / disable the auto-attach via allstak.init(..., capture_fastapi=False)):

from fastapi import FastAPI
from allstak.integrations.fastapi import AllStakFastAPI

app = FastAPI()
AllStakFastAPI(app, service="checkout-api")

Logs

allstak.init(...) auto-attaches the logging bridge (disable with capture_logs=False), so standard-library logs flow to AllStak with no extra code. ERROR/CRITICAL records become error events (with the exception + stack for logger.exception(...)), and lower levels become breadcrumbs:

import logging

logging.getLogger("checkout").error("payment declined")
try:
    charge()
except Exception:
    logging.getLogger("checkout").exception("charge crashed")  # captured with stack

Flask

from flask import Flask
from allstak.integrations.flask import AllStakFlask

app = Flask(__name__)
AllStakFlask(app)

Django

Add "allstak" to INSTALLED_APPS and the SDK auto-inserts its request middleware for you — no manual MIDDLEWARE edit needed:

INSTALLED_APPS = [
    # ...
    "allstak",
]

ALLSTAK = {
    "api_key": "ask_live_...",
    "environment": "production",
    # "auto_middleware": False,  # opt out of auto-insertion
}

Prefer to wire it by hand? Add the middleware at the front of the stack (AllStakDjangoMiddleware is an alias of the same class):

MIDDLEWARE = [
    "allstak.integrations.django.AllStakMiddleware",
    *MIDDLEWARE,
]

Spans

with allstak.start_span("checkout.authorize", tags={"provider": "payments"}):
    authorize_payment()

Configuration

Option Description
api_key Project API key.
environment Deployment environment.
release App version or commit SHA.
flush_interval_ms Background flush interval.
buffer_size Max buffered events.

Privacy

The SDK redacts common sensitive headers and fields. Avoid putting secrets in custom metadata.

Troubleshooting

  • No events: confirm ALLSTAK_API_KEY is set before allstak.init(...).
  • Missing request telemetry: register the framework integration during app startup.
  • Short-lived script: call allstak.get_client().flush() before exit when a client is initialized.

Contributing and Support

License

MIT

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

allstak-0.2.0.tar.gz (131.6 kB view details)

Uploaded Source

Built Distribution

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

allstak-0.2.0-py3-none-any.whl (110.4 kB view details)

Uploaded Python 3

File details

Details for the file allstak-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for allstak-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d752422241f95f20e1f528194bf2a42691b3c215a478324200b51b1cb3b8bf1e
MD5 918475b8fac30a937fd18a55ac3afc63
BLAKE2b-256 3acd16abe6472644badcb06b4cb769cfdb462c1df454bebd439986f3ba29351c

See more details on using hashes here.

Provenance

The following attestation bundles were made for allstak-0.2.0.tar.gz:

Publisher: publish.yml on AllStak/allstak-python

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

File details

Details for the file allstak-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for allstak-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08acbd641ca6eb65737b487427b33cbe84ee6ee4044654c951efe1db507f2699
MD5 0194dc4f669d1ada829f12a7b8f4f215
BLAKE2b-256 e62b5f8fde53c8edabc6973341449682b2e4bb9e2772cbaec87eced69bffee7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for allstak-0.2.0-py3-none-any.whl:

Publisher: publish.yml on AllStak/allstak-python

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