Skip to main content

Ampy Observability SDK (Python) — logs, metrics, tracing

Project description

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

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

ampyobs-0.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

ampyobs-0.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file ampyobs-0.0.2.tar.gz.

File metadata

  • Download URL: ampyobs-0.0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for ampyobs-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a35ad71847867937a9c3931f15ad32896987ecdce5e2837b2fa868e6a279444f
MD5 48f01afefdd17c7f16f888ddbe3dab5a
BLAKE2b-256 1b80b20a4c3155184d474d1df00ffe614b5738268c068fd3c1e4f0256838e96a

See more details on using hashes here.

File details

Details for the file ampyobs-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: ampyobs-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for ampyobs-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 261e8b7ffded2b7177d74349ac26425c5b332d75f7b00ba6fc944635d3019dfb
MD5 59b015ef0149e4db9814eb912180b5bf
BLAKE2b-256 fe1e16c961f911474cc9c74b1a4986da96a5f8693477770546e800c1ebfc5308

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