Skip to main content

watchtower-lite

Zero-dependency (stdlib only, Python >= 3.9) Watchtower client for small services that cannot take the full OpenTelemetry SDK. It sends OTLP/HTTP JSON to the ingest gateway from a background thread and never raises into your code. For richer instrumentation use watchtower-observability instead.

pip install watchtower-lite
import watchtower_lite as wt

wt.init()  # reads WT_INGEST_KEY, WT_SERVICE, WT_ENVIRONMENT, WT_RELEASE, WT_OTLP_ENDPOINT; no-op without a key
wt.log("started", level="info", port=8080)

try:
    risky()
except Exception:
    wt.capture_exception(job="nightly")   # becomes an issue

with wt.span("infer", attrs={"model": "x"}, headers=request.headers):  # continues incoming traceparent
    requests.get(url, headers={"traceparent": wt.traceparent()})
# an exception inside the block marks the span as error, records it, and is re-raised
wt.flush(timeout=2.0)   # also flushed at exit

Default endpoint: https://ingest.watchtowerops.net (key set), override with WT_OTLP_ENDPOINT (use http://localhost:4318 for a local gateway). The key is sent as x-watchtower-key.

Batches flush every 2 s or 256 items. The queue holds 2048 items; when full the oldest is dropped (wt.dropped() counts drops, including failed sends). Delivery is best effort, no retries. Resource attributes: service.name, deployment.environment, service.version, telemetry.sdk.name=watchtower-lite.

Plain HTTP recipe

No library needed; any language can do this:

curl -X POST https://ingest.watchtowerops.net/v1/logs \
  -H 'Content-Type: application/json' -H "x-watchtower-key: $WT_INGEST_KEY" \
  -d '{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"my-svc"}}]},
       "scopeLogs":[{"logRecords":[{"timeUnixNano":"1760000000000000000","severityNumber":9,
       "severityText":"INFO","body":{"stringValue":"hello"}}]}]}]}'

Spans go to /v1/traces the same way (resourceSpans / scopeSpans / spans). An exception is a span event named exception with exception.type, exception.message and exception.stacktrace.

Test

python3 -m unittest discover -s tests

Metadata

Release files for watchtower-lite 0.1.0

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

Source distribution (sdist)

Source distribution for watchtower-lite 0.1.0
File Size Uploaded Provenance Actions
watchtower_lite-0.1.0.tar.gz 10.1 kB Without provenance Details for watchtower_lite-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for watchtower-lite 0.1.0
File Interpreter ABI Platform Actions
watchtower_lite-0.1.0-py3-none-any.whl Python 3 none any Details for watchtower_lite-0.1.0-py3-none-any.whl

Total release size: 19.2 kB

Release files / watchtower_lite-0.1.0.tar.gz

Download URL watchtower_lite-0.1.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
57b1a3ee9264bf5cb0eb0a839c21fbf35c1fe4c1ff53b13c8eae9f4becde507d
BLAKE2b-256 checksum
How to use checksums
1076cfaa734f4a0b29412563fd696f1eb62945fa358072577ee64995c3284e1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / watchtower_lite-0.1.0-py3-none-any.whl

Download URL watchtower_lite-0.1.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d789463ae99631d82381314ad8cea363e49bb1c11ec02692668e2c592255edb
BLAKE2b-256 checksum
How to use checksums
7fb46f23834c523b73203f3b443e9c8005e6ec7b28256de666b50c26a3017e3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for watchtower-lite 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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