Skip to main content

Python package to implement observability domain probes

Project description

domprob 🛰️

Inspired by this blog post, domprob is a Python package to implement observability domain probes in your projects.

PyPI - Package Version PyPI - Python Version codecov pre-commit Checked with mypy Code style: black

📄 Documentation | 🐍 PyPI

Overview

Keep your business logic comprehensible by abstracting the observability code away.

Turn this (19 lines):

class Order:
    def checkout(self):
        self.logger.log(f"Attempting to checkout order {self.order}")
        try:
            self.checkout_service.checkout_order(self.order)
        except CheckoutError as e:
            self.logger.error(f"Checkout for order {self.order} failed: {e}")
            self.metrics.increment("checkout-failed", {
                "failed_orders": 1, "customer": 6234654
            })
            return
        self.logger.log(f"Order checkout completed successfully")
        self.metrics.increment("checkout-successful", {
            "successful_orders": 1, 
            "customer": 6234654, 
            "order_number": 2374, 
            "sku": "JH-374-VJHV"
        })
        self.analytics.add(**self.order.to_dict())

→ Into ✨this✨ (9 lines):

class Order:
    def checkout(self):
        probe.announce(AttemptingCheckoutObservation())
        try:
            self.checkout_service.checkout_order(self.order)
        except CheckoutError as e:
            probe.announce(CheckoutFailedObservation())
            return
        probe.announce(CheckoutSuccessfulObservation())

Installation

Install using uv:

uv add domprob

Using pip:

pip install domprob

Using poetry:

poetry add domprob

Usage

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

domprob-0.1.0a5.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

domprob-0.1.0a5-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file domprob-0.1.0a5.tar.gz.

File metadata

  • Download URL: domprob-0.1.0a5.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for domprob-0.1.0a5.tar.gz
Algorithm Hash digest
SHA256 91eedbad39b2f3cd9d852cc138dbd85a74a639dda4fd99133d9730d2a8ae3d56
MD5 157e40c8c692f171ae1aa4ec41a86a67
BLAKE2b-256 05e721b129c8e358f16e3001316c8da68d4ca2e37ce766423d53cf4471773f5a

See more details on using hashes here.

File details

Details for the file domprob-0.1.0a5-py3-none-any.whl.

File metadata

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

File hashes

Hashes for domprob-0.1.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 0474515b7eab7cb32e653fc4c52e8e10963ae5bdbaa15a1a28cfdc4189da86e0
MD5 f327faef23396bbaba1b5ba96239fd06
BLAKE2b-256 a8f03f25c05b65a8e7b8ccbe14bd8c516de1ac64d2ae87366849d1a016371e77

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