Skip to main content

Pontem edge SDK — logs, metrics, and config for edge devices

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()

Stdout emit (Docker / compose)

For containerized deployments where a sidecar log collector tails the container's stdout, switch the SDK from file mode to stdout mode:

import pontem

pontem.init(service_name="my-service", emit_target="stdout")

Equivalently, set the env var (useful when the same image runs on both edge devices and compose hosts):

PONTEM_EMIT_TARGET=stdout

Selection precedence: init(emit_target=...) kwarg > PONTEM_EMIT_TARGET env var > default "file". In stdout mode emit_dir, file rotation, and gzip compression are no-ops — the docker daemon's json-file driver handles container log rotation.

The JSONL line shape is identical in both modes. See SCHEMA.md for the full record schema — that file is the contract between this SDK and any log collector that ingests its output.

Logging

Structured logs with OTel-aligned severity levels. Each log is written to logs.jsonl in the emit directory (or to stdout, one record per line, when emit_target="stdout" — see Stdout emit).

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pontem-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

pontem-0.1.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file pontem-0.1.0.tar.gz.

File metadata

  • Download URL: pontem-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pontem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f000f9c800f7e0659eb84f82f2b52b9a4fb504fdac8590da23ba102122a78443
MD5 b7a70adb97b9379ea676fe02e4c98078
BLAKE2b-256 5a37e497f217c208351f8d5351b3b7951eaed7f370aea2888ec29c9ceadc058e

See more details on using hashes here.

File details

Details for the file pontem-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pontem-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pontem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 171dcaef5b61f27b7e8dfd2500217156c18c08cda7908d84e68614cc0d84643f
MD5 13fbdd171b0a7cce505032afc8cd73bf
BLAKE2b-256 f9349e4d84ff083362a2b41158bdb6c37a76fadbffa4a6327a29221b8b832390

See more details on using hashes here.

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