Skip to main content

obs-app-sdk

Python client for the obs-app.ctsoftware.co.uk ingestion API - send logs, metrics and traces from your application.

Install

pip install ct_obs_app

(the PyPI project is named ct_obs_app; the importable module is obs_app_sdk - see Quickstart below)

Get an API key

Log in at the obs_app dashboard and copy your API key from the profile page (rotate it there too, if needed). The SDK authenticates every request with it.

Quickstart

from obs_app_sdk import Client, CaptureTrace

client = Client(api_key="your-api-key")

# Logging
client.log("Something happened", level=4)  # 1=Critical .. 5=Debug, default 4=Info
client.log_batch([{"message": "a"}, {"message": "b"}])

# Metrics
client.add_metric(value=1.0, metric="request_duration_ms", auto_create=True)
client.add_metrics([
    {"metric": "request_duration_ms", "value": 12.3},
    {"metric": "queue_depth", "value": 4},
], auto_create=True)

# Traces - nested context managers build one tree, sent as a single request when the
# outermost one exits
with CaptureTrace(client, "handle_request"):
    with CaptureTrace(client, "query_db"):
        ...
    with CaptureTrace(client, "render_response"):
        ...

# Or submit logs/metrics/traces together in one request (validated all-or-nothing)
client.ingest(
    logs={"logs": [{"message": "started"}]},
    metrics={"metrics": [{"metric": "request_duration_ms", "value": 12.3}]},
    traces=[{"start": "...", "end": "...", "text": "handled"}],
)

Stdlib logging integration

import logging
from obs_app_sdk import Client, ObsAppLogHandler

client = Client(api_key="your-api-key")
logging.getLogger().addHandler(ObsAppLogHandler(client))

Each stdlib log record becomes one POST /api/log/ call. For high-volume logging, call client.log_batch(...) directly instead of relying on the handler.

Error handling

All methods raise on non-2xx responses:

  • ObsAppApiKeyError - missing/invalid API key (HTTP 401)
  • ObsAppValidationError - invalid request data (HTTP 400); .errors holds the server's per-field error dict when there is one, else None
  • ObsAppRateLimitedError - HTTP 429. The API blocks the offending IP for 1 hour once its rolling rate-limit window trips - do not retry in a loop on this error, it won't help
  • ObsAppError - base class; also raised for network failures and unexpected status codes

Notes

  • This client is synchronous and makes one HTTP request per call - there is no background buffering/auto-flush thread. Use the batch methods (log_batch, add_metrics, ingest) to reduce request count for high-volume callers.
  • add_metrics (batch) only supports metric names, not metric_id - use add_metric (singular) for id-based lookups.

Metadata

Release files for ct-obs-app 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ct-obs-app 0.1.1
File Size Uploaded Provenance Actions
ct_obs_app-0.1.1.tar.gz 8.8 kB With provenance Details for ct_obs_app-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ct-obs-app 0.1.1
File Interpreter ABI Platform Actions
ct_obs_app-0.1.1-py3-none-any.whl Python 3 none any Details for ct_obs_app-0.1.1-py3-none-any.whl

Total release size: 17.5 kB

Release files / ct_obs_app-0.1.1.tar.gz

Download URL ct_obs_app-0.1.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3b20e373e3425a29c1d126c8247ef797de5e39eb75c22f606d83cee4316bcadb
BLAKE2b-256 checksum
How to use checksums
acbfb21323b1f9d6b9288b7bda975a9dc73a92e6f898dcc0f84797e520352524
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Release files / ct_obs_app-0.1.1-py3-none-any.whl

Download URL ct_obs_app-0.1.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe227117e3682de4980f418e6658fd6c4cf4d9cad2f28de7f9f697a3527177e0
BLAKE2b-256 checksum
How to use checksums
3719f35a5e067c0b7dd3a7c23890555a4768c309805ae04c96d37cb36bd7b96d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Security for ct-obs-app 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ct_obs_app-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page