Skip to main content

Hostess SDK for Python — native API Insights for FastAPI and beyond.

Project description

hostess-python

The Hostess SDK for Python. Native API Insights for FastAPI (and, later, other Python frameworks) with one line of code.

pip install "hostess-python[fastapi]"
from fastapi import FastAPI
from hostess_sdk.fastapi import instrument

app = FastAPI()
instrument(app)

That's it. When deployed on Hostess, route-level traffic, latency, status codes, and error rates appear in Studio — no OTLP, collector, or Prometheus configuration required.

What instrument(app) does

  • Applies OpenTelemetry FastAPI instrumentation, so requests produce server spans carrying the route template (/items/{item_id}), method, and status — never raw paths or query strings.
  • Exports spans over OTLP/HTTP to the Hostess collector. The endpoint is injected by the platform (HOSTESS_OTEL_ENDPOINT); override with otlp_endpoint= for local use.
  • Emits a periodic marker heartbeat so Studio can tell "installed, waiting for traffic" from "not installed".

It is idempotent, fails silent and cheap (bounded queue, never adds request latency or crashes the app), and is a clean no-op when disabled (enabled=False / HOSTESS_INSTRUMENTATION=false) or when no collector endpoint is available.

Options

instrument(
    app,
    enabled=None,            # None → env (HOSTESS_INSTRUMENTATION), default on
    service_name=None,       # defaults to the platform-injected name
    exclude_paths=["/health"],
    otlp_endpoint=None,      # local/advanced override
)

Privacy

The helper collects HTTP method, route template, status code, and duration. It never collects request/response bodies, query strings, raw URLs, headers, cookies, tokens, user IDs, or client IPs.

Development

uv sync
uv run pytest

Status

v0.1 — instrument(app) for FastAPI. Roadmap: a HostessFastAPI drop-in, opt-in exception metrics, and additional framework helpers (Django, Flask).

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

hostess_python-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

hostess_python-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file hostess_python-0.1.0.tar.gz.

File metadata

  • Download URL: hostess_python-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hostess_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cfd7a621057f9aeb741eca9d639bf69fc729a60a7e0c150621336a24bdd6a776
MD5 dc39a9b00ef7d85c5982974d75b0e806
BLAKE2b-256 6a4cf1e3775afcc957bd191c89c3c5abad8abe645854c82e08ebff4472b2cdbd

See more details on using hashes here.

File details

Details for the file hostess_python-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hostess_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hostess_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e10128a84f925b9aca7ba5e0348815f8c24f6626c423140058fc0ac4761f7a62
MD5 81287b8ccc09a4e6d8a03b5b2a59f925
BLAKE2b-256 622a0ac63f6ccc71538092c0d98c6f20c3b78d7a83d87ce74087aa8d63b5d63a

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