Skip to main content

A simple and non-blocking Python package for sending custom metrics to Watchlog.

Project description

watchlog-python

A lightweight, non-blocking Python client for sending custom metrics to the Watchlog monitoring platform.

🚀 Installation

Install the package using pip:

pip install watchlog-python

📦 Usage

1. Import the Watchlog class

from watchlog import Watchlog

2. Create an instance of Watchlog

watchlog_instance = Watchlog()

3. Send metrics using simple method calls

# Increment a counter
watchlog_instance.increment('page_views', 10)

# Decrement a counter
watchlog_instance.decrement('items_in_cart', 2)

# Set a gauge value
watchlog_instance.gauge('current_temperature', 22.5)

# Set a percentage value (0 to 100)
watchlog_instance.percentage('completion_rate', 85)

# Log system byte metric (e.g., memory usage in bytes)
watchlog_instance.systembyte('memory_usage', 1024)

All operations are performed asynchronously and silently, ensuring zero interruption to your main application.

🌐 Example Usage in a Django View

# views.py
from django.http import HttpResponse
from watchlog import Watchlog

watchlog_instance = Watchlog()

def some_view(request):
    watchlog_instance.increment('view_hits')
    return HttpResponse("This is a view that increments a metric.")

✅ Features

  • ⚡️ Non-blocking & thread-based HTTP request
  • 🛡️ No logging, printing, or exception leaks
  • 🔐 Safe and isolated from your main application flow
  • 🧩 Easy to integrate with any Python web framework

📄 License

MIT License

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

watchlog_python-0.2.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file watchlog_python-0.2.2.tar.gz.

File metadata

  • Download URL: watchlog_python-0.2.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for watchlog_python-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b7a2ebbb47df45091ca24ad68e28466dacafc227f09b0e9da96a2fa688cb1ee0
MD5 a7c391fd23bc2164dcbbb15bc0211c42
BLAKE2b-256 05dff1d6c41e17e91f7eea8ebdb9c10172c7aa2a0fcb733e3b5e135d2f65fa2d

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