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.0a4.tar.gz (29.7 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.0a4-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: domprob-0.1.0a4.tar.gz
  • Upload date:
  • Size: 29.7 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.0a4.tar.gz
Algorithm Hash digest
SHA256 ccff2f7a0774c2dd69af18c5f9d8ba62653ce7266d6898d0a0b80b040917d362
MD5 e0a47f47285eac75104a89496fd6ff0e
BLAKE2b-256 996d087b626be1c0a80c1e202e2569bb23b077ed24c1260b42f1920a8e8d1548

See more details on using hashes here.

File details

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

File metadata

  • Download URL: domprob-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 37.3 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.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 5586b739f21032bfee99ca2dbe0a6ce0896c5a68c943876a5b7037fbd417876e
MD5 f60486b079215da1b9ea0d9208a76021
BLAKE2b-256 0558e51934eb799c49edc896d121b56a1cf8211b86719fd8d5cf0ee6b0da0ed2

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