Skip to main content

Ampy Observability SDK (Python)

Python SDK for Ampy observability stack - logs, metrics, and tracing.

Installation

pip install -e ./python  # Editable install for development

Quick Start

from ampyobs import Config, init, shutdown
from ampyobs.logger import L
from ampyobs.tracing import BusAttrs, start_bus_publish
from ampyobs.metrics import init_instruments, bus_produced

# Initialize
init(Config(service_name="my-service", collector_endpoint="localhost:4317"))
init_instruments()

# Logging with trace context
L.info("Processing order", extra={"order_id": "12345"})

# Tracing
attrs = BusAttrs(topic="orders", schema_fqdn="order.v1", message_id="123", partition_key="AAPL", run_id="run1")
ctx, span = start_bus_publish(attrs)
try:
    # Your business logic
    pass
finally:
    span.end()

# Metrics
bus_produced("orders", 1, service="my-service", env="dev")

# Cleanup
shutdown()

Examples

See python/examples/ for complete producer/consumer and metrics demos.

Configuration

The SDK sends telemetry to your local OTel Collector (localhost:4317 by default).

Metadata

Release files for ampyobs 0.0.2

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

Source distribution (sdist)

Source distribution for ampyobs 0.0.2
File Size Uploaded
ampyobs-0.0.2.tar.gz 5.1 kB Details

Built distribution (wheel)

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

Total release size: 11.2 kB

Release files / ampyobs-0.0.2.tar.gz

Download URL ampyobs-0.0.2.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a35ad71847867937a9c3931f15ad32896987ecdce5e2837b2fa868e6a279444f
BLAKE2b-256 checksum
How to use checksums
1b80b20a4c3155184d474d1df00ffe614b5738268c068fd3c1e4f0256838e96a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / ampyobs-0.0.2-py3-none-any.whl

Download URL ampyobs-0.0.2-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
261e8b7ffded2b7177d74349ac26425c5b332d75f7b00ba6fc944635d3019dfb
BLAKE2b-256 checksum
How to use checksums
fe1e16c961f911474cc9c74b1a4986da96a5f8693477770546e800c1ebfc5308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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