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.1.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.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ampyobs-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1b7ba5a7143bced29588de15f03ea55b663a4c59b89837398f38d8ecb7b3ecf2
MD5 0a5b705f5299618d575048e1a40b0f67
BLAKE2b-256 449518e51a1f6a61e2d1aaead738576fbfef1a7b5c9a0ff1bd1fb5ef356ce03c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ampyobs-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4ee9116b46692da11da7017f43dcf5195de880962e9f70c2932aaf7882d7541
MD5 79383039fcfe4bfc787bacf049e128ec
BLAKE2b-256 b0ed3ec82ca1a8ac454528ffe921413408cbd638e1d0396adebb69faf1dfe606

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