Python Custom Metrics Made Simple

Monitor custom metrics in Python with our lightweight library.

What are Custom Metrics?

Custom metrics allow you to track specific aspects of your application, such as performance or user behavior. Watchlog's Python library makes this effortless with just a few lines of code.

Custom Metrics

How to Send Metrics with Watchlog

Use the watchlog-python library to send custom metrics. Install the package and use methods like increment, decrement, gauge, percentage, or systembyte to monitor your app.

  1. Increment: Increase a metric by a specific value (default: 1).
  2. Decrement: Decrease a metric by a specific value (default: 1).
  3. Gauge: Record a precise value, such as temperature or active sessions.
  4. Percentage: Send percentage values (0 to 100).
  5. System Byte: Send metrics like memory usage in bytes.

Sample Code

  
  from watchlog import Watchlog
  
  watchlog_instance = Watchlog()
  
  # Increment the specified metric by the given value (default is 1)
  watchlog_instance.increment('page_views', 10)
  
  # Decrement the specified metric by the given value (default is 1)
  watchlog_instance.decrement('items_in_cart', 2)
  
  # Set the specified metric to the given value
  watchlog_instance.gauge('current_temperature', 22.5)
  
  # Set the specified metric to a percentage value (0 to 100)
  watchlog_instance.percentage('completion_rate', 85)
  
  # Log a system byte metric
  watchlog_instance.systembyte('memory_usage', 1024)  # Example: 1024 bytes
  
        

Getting Started

To begin, install the library with pip install watchlog-python and integrate it using the examples above. Refer to our documentation for detailed setup instructions.

View Documentation

Track Python Metrics Effortlessly

Sign up for Watchlog and start monitoring your custom metrics today.

View Pricing