Skip to main content

LevelOps Python SDK

Ingest SLI events into LevelOps from any Python application.

Installation

pip install levelops

Quickstart

from levelops import LevelOpsClient

client = LevelOpsClient(api_key="<tenant_key>", sli_id="<uuid>")
client.record(fields={"result": "ok", "latency_ms": 120})
client.flush()

Usage

Direct record

# Auto-generated event_id (UUID v4)
client.record(
    fields={"result": "ok", "latency_ms": 120},
    dimensions={"service": "api", "region": "eu"},
)

# Explicit event_id for idempotent retries
client.record(fields={"result": "ok"}, event_id="my-trace-id")

Context manager (auto latency measurement)

# event_id auto-generated
with client.measure(dimensions={"service": "api"}) as ctx:
    # ... business logic ...
    ctx.set_result("ok")  # or "error"

# Explicit event_id
with client.measure(dimensions={"service": "api"}, event_id="trace-id") as ctx:
    ctx.set_result("ok")

Configuration

Parameter Default Description
api_key — Tenant API key (required)
sli_id — Target SLI UUID (required)
base_url https://api.levelops.io API base URL
batch_size 100 Flush after N events
flush_interval 1.0 Flush every N seconds

Behaviour

  • event_id auto-generated (UUID v4) per record() and per measure() exit. Override via event_id= parameter for idempotent retries.
  • timestamp auto-set to UTC now if not provided.
  • Thread-safe internal buffer flushed in background thread.
  • Retries on HTTP 429 respecting Retry-After header (max 3 attempts, exponential backoff).
  • flush() registered via atexit automatically.

Metadata

Release files for levelops 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 levelops 0.1.0
File Size Uploaded Provenance Actions
levelops-0.1.0.tar.gz 3.2 kB Without provenance Details for levelops-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 6.9 kB

Release files / levelops-0.1.0.tar.gz

Download URL levelops-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d563a5d4ca4840d62d9e1c3c88e12aadae5fa910c04468d2916d9d7cd205d9a0
BLAKE2b-256 checksum
How to use checksums
d923d856b17fde388eebc1d1c816cff7fcc70aca7c4f41830ddb4edadbca4f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

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

Download URL levelops-0.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
159ff13924ac88366d9c7492b57d31f5f3fbfd7d5cca04b6d61439b9a1e2d92f
BLAKE2b-256 checksum
How to use checksums
7077cb9175f0d8b54f7415dd9a6790a7d5a6ac7d24d9976c9489c4dbe7e69099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for levelops 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