pamoja-telemetry
Observability that ships only what is worth the bytes as link cost rises, while counting everything. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
pip install pamoja-telemetry
from pamoja import telemetry
This pulls in pamoja-native, the compiled engine. pip install pamoja is the whole framework in one package.
Example
The script the test suite runs, spliced here as it ran.
From bindings/python/guides/telemetry.py:
from pamoja.telemetry import Event, Level, LinkCost, Reporter
def fate(event: Event | None, kept: str) -> str:
"""What a node does with an event the reporter hands back: on a link it sends it, and
with no link it keeps it for when one returns."""
return "counted only" if event is None else kept
# On the site's own network nothing is held back.
reporter = Reporter(Level.TRACE)
reporter.adapt_to(LinkCost.FREE)
tick = reporter.record(Event(Level.DEBUG, "loop.tick"))
print(f"free nothing is held back: loop.tick {fate(tick, 'sent')}")
# On a metered link the bar rises to Info. Routine detail stops going out; a reading and a
# warning still do, and a warning carries the measurement that raised it.
reporter.adapt_to(LinkCost.METERED)
tick = reporter.record(Event(Level.DEBUG, "loop.tick"))
reading = reporter.record(Event(Level.INFO, "reading.ok", 4.8))
print(
f"metered nothing below {reporter.threshold.value} is sent: "
f"loop.tick {fate(tick, 'sent')}, reading.ok {fate(reading, 'sent')}"
)
warned = reporter.record(Event(Level.WARN, "battery.low", 0.18))
print(f"metered {warned.code} sent, carrying {warned.value:.2f}")
# On satellite the bar is Warn: the same reading is no longer worth its bytes, and a
# failure still is.
reporter.adapt_to(LinkCost.EXPENSIVE)
reading = reporter.record(Event(Level.INFO, "reading.ok", 4.9))
lost = reporter.record(Event(Level.ERROR, "link.lost"))
print(
f"satellite nothing below {reporter.threshold.value} is sent: "
f"reading.ok {fate(reading, 'sent')}, link.lost {fate(lost, 'sent')}"
)
# With no link at all only errors are kept, for the link's return.
reporter.adapt_to(LinkCost.OFFLINE)
low = reporter.record(Event(Level.WARN, "battery.low", 0.17))
lost = reporter.record(Event(Level.ERROR, "link.lost"))
print(
f"offline nothing below {reporter.threshold.value} is kept: "
f"battery.low {fate(low, 'kept')}, link.lost {fate(lost, 'kept')}"
)
# Only the stream was thinned, not the counts, so every event is still accounted for, and
# the snapshot is what the node ships in place of them.
snapshot = reporter.snapshot()
print(
f"counts of {reporter.total} events, {snapshot.emitted} passed the bar and "
f"{snapshot.dropped} were counted only"
)
print(
f"levels trace {snapshot.trace}, debug {snapshot.debug}, info {snapshot.info}, "
f"warn {snapshot.warn}, error {snapshot.error}"
)
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-telemetry |
reference, docs.rs, install |
| TypeScript | @pamoja/telemetry |
reference, install |
| Python | pamoja-telemetry |
reference, install |
| C# | Pamoja.Telemetry |
reference, install |
Documentation
pamoja.telemetryreference, every class and function in this module.- The Telemetry guide, with the same example in Rust, TypeScript, and C#.
- Every capability, and the install page.
License
MIT
Release files for pamoja-telemetry 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pamoja_telemetry-0.2.0.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pamoja_telemetry-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / pamoja_telemetry-0.2.0.tar.gz
| Download URL | pamoja_telemetry-0.2.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe9db57b7b838147845f38849d05cacae285dc6891b369def8637cae3585c9cf
|
|
BLAKE2b-256 checksum How to use checksums |
116b5e8914f3600d6e3f97aa26a5eabeb738a39006e5acd163f775be6ad84dab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / pamoja_telemetry-0.2.0-py3-none-any.whl
| Download URL | pamoja_telemetry-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90b2c87cc03b0e0112b4555aba08947ad7d1572715167f5a32fa81682e84a9af
|
|
BLAKE2b-256 checksum How to use checksums |
ee54761b23d345a1ae43f6a764af937294ee739c1ef9292516d01d119a98c48a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|