Pontem SDK — logs, metrics, and config
Project description
Pontem Python SDK
Pontem Python SDK for logs, metrics, and config on Pontem-managed edge devices. Zero runtime dependencies.
Installation
pip install pontem
Quick Start
import pontem
pontem.init(service_name="my-service")
pontem.logger.info("model loaded", model="scoring_v3")
pontem.metrics.count("detections", class_name="apple")
with pontem.metrics.timer("model.inference"):
result = model.predict(frame)
pontem.shutdown()
Usage
Logging
Structured logs with OTel-aligned severity levels. Each log is written to logs.jsonl in the emit directory.
pontem.logger.info("model loaded", model="scoring_v3")
pontem.logger.warn("high latency", latency_ms=120)
pontem.logger.error("inference failed", error=str(e))
Available levels: trace, debug, info, warn, error, fatal.
Metrics
Metrics are aggregated in memory and flushed periodically to metrics.jsonl. No I/O on the caller's thread.
# Counters — incremented, flushed as a single sum
pontem.metrics.count("detections", class_name="apple")
pontem.metrics.count("bytes_sent", len(payload))
# Histograms — records min/max/sum/count summary
pontem.metrics.record("payload_size", len(data), unit="bytes")
# Gauges — last value wins
pontem.metrics.set_gauge("gpu_temp", 72.0, unit="celsius", gpu="0")
# Timers — context manager or decorator, records to histogram
with pontem.metrics.timer("model.inference"):
result = model.predict(frame)
@pontem.metrics.timer("preprocessing")
def preprocess(frame):
...
Config
Reads agent-managed config from /opt/pontem/config/config.json (or $PONTEM_CONFIG_DIR).
threshold = pontem.config("my_namespace", "model_threshold", default=0.85)
# Reload after agent signals a config update
pontem.config.reload()
Shutdown
Flushes remaining metrics and logs. Also registered via atexit.
pontem.shutdown()
Documentation
See docs/getting-started.md for a comprehensive guide including full API reference, configuration options, and troubleshooting.
License
Apache 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pontem-0.0.5.tar.gz.
File metadata
- Download URL: pontem-0.0.5.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0ebb994b846d98ba28dd0a70e2c962598315717e86f59178be3f35e6533c300
|
|
| MD5 |
52608ce0e4058cf27703271b1b284d4f
|
|
| BLAKE2b-256 |
e82dab0c5a810dc991e257288adc314d61180eaa440683aab172ab849d1628ad
|
File details
Details for the file pontem-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pontem-0.0.5-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2363f145ee5bae1d4c20f7ead9cc4405a40dcdb7dd9d94232d688538793ade23
|
|
| MD5 |
b4b40b8fe1b469b31e178abf8b22fdc8
|
|
| BLAKE2b-256 |
18299a817f4eaec9833a1203b29fac8ca80fad98971eefcca7c43d5d85d6969c
|