Skip to main content

RuntimeScope SDK for Python — runtime profiling and telemetry for Django, Flask, FastAPI, and any Python app

Project description

runtimescope (Python)

Python SDK for RuntimeScope — runtime profiling and telemetry for Django, Flask, FastAPI, and any Python app.

pip install runtimescope

Zero required dependencies — the SDK uses only the Python standard library. Framework integrations (Django / Flask / FastAPI) are opt-in.

Quick Start

from runtimescope import RuntimeScope

RuntimeScope.connect(dsn="runtimescope://proj_xxx@localhost:6768/my-app")
# or set RUNTIMESCOPE_DSN in your environment and call with no args:
RuntimeScope.connect()

RuntimeScope.track("user_signed_up", {"plan": "pro"})
RuntimeScope.add_breadcrumb("task started", {"task_id": 42})

When RUNTIMESCOPE_DSN is not set, the SDK is completely inert — no connection attempts, no patching, zero overhead. Safe to ship to production.

Framework Integrations

Django

# settings.py
MIDDLEWARE = [
    "runtimescope.integrations.django.RuntimeScopeMiddleware",
    # ...
]

# Optional: set DSN via Django settings (otherwise uses RUNTIMESCOPE_DSN env var)
RUNTIMESCOPE_DSN = "runtimescope://proj_xxx@localhost:6768/my-django-app"

Flask

from flask import Flask
from runtimescope.integrations.flask import init_app

app = Flask(__name__)
init_app(app)  # reads RUNTIMESCOPE_DSN from env

FastAPI

from fastapi import FastAPI
from runtimescope.integrations.fastapi import RuntimeScopeMiddleware

app = FastAPI()
app.add_middleware(RuntimeScopeMiddleware)

What Gets Captured

Capture Default How
Every HTTP request ✅ via middleware method, URL, status, duration
Uncaught exceptions sys.excepthook hook
logging.WARNING+ Python logging handler
Custom events Manual RuntimeScope.track(name, properties)
Breadcrumbs Manual RuntimeScope.add_breadcrumb(msg, data)
Manual exception Manual RuntimeScope.capture_exception(exc)

You can disable the auto-captures via connect() kwargs:

RuntimeScope.connect(
    dsn="...",
    capture_errors=False,    # don't install sys.excepthook
    capture_logging=False,   # don't hook into `logging`
)

DSN Format

Same as every other RuntimeScope SDK:

runtimescope://proj_xxx@host:6768/app-name
runtimescopes://proj_xxx@runtimescope.example.com/app-name   # TLS

The HTTP port is canonical; the WebSocket port is derived as http_port - 1.

Auth Tokens

Pass auth_token="..." to connect() or set RUNTIMESCOPE_AUTH_TOKEN in the environment. The token is sent as a Bearer header on every POST.

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

runtimescope-0.10.8.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

runtimescope-0.10.8-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file runtimescope-0.10.8.tar.gz.

File metadata

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

File hashes

Hashes for runtimescope-0.10.8.tar.gz
Algorithm Hash digest
SHA256 7d80ca8dcf3a7d709d310a7939e2fbe21815e3bf15ec97965bc022f49be8ea76
MD5 7ba72e1bf240b8335f89facc8586d01f
BLAKE2b-256 4d2ead08d24fda5770d06354c49eaf0456fd945bf6f5d821a57b4ef268afd28f

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtimescope-0.10.8.tar.gz:

Publisher: publish-pypi.yml on edwinlov3tt/runtimescope

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

File details

Details for the file runtimescope-0.10.8-py3-none-any.whl.

File metadata

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

File hashes

Hashes for runtimescope-0.10.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4b13bf31af2e4cd687474339dcd11fa44790f6bc38a2687499814df2a6062898
MD5 479426adbba4591848fc4260dafbeb3d
BLAKE2b-256 6347a7784e9b83773b6b65488efa3251b18fd497c274478f4f4089fa83391ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtimescope-0.10.8-py3-none-any.whl:

Publisher: publish-pypi.yml on edwinlov3tt/runtimescope

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