Skip to main content

No project description provided

Project description

Process Monitor

A python tool that utilizes redis to keep track of long-running processes. It triggers a signal every n seconds, so that a health check/monitoring API can view the last signal timestamp.

Requirements

  • redis

Configuration

  • redis connection parameters to be passed directly to the redis client.

Usage

Consumer

from process_monitor import Monitor


class MyProcess:
    def __init__(self):
        self.monitor = Monitor(args)
        self.monitor.run_signals_worker('process-name')

API - Monitor

from process_monitor import Reader

@route('/check-process')
def check_process():
    monitor_reader = Reader(redis_client=Redis(...))
    results = monitor_reader.read()
    # {'process-name': {
    #     'last_signal': '2021-08-03 22:36:55.457416',
    #     'last_signal_age': 3,
    #     'info': {
    #       'x': 1
    #     }
    # }}
    return Response(data=results)

Example

example

Custom Monitors

Kinesis Consumer Monitor

from process_monitor import ConsumerMonitor

class MyConsumer:
    def __init__(self):
        self.monitor = ConsumerMonitor(args)
        self.monitor.run_signals_worker('consumer-name')

    def process_record(self, record):
        self.monitor.received_record()
        ...

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

process_monitor-0.0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

process_monitor-0.0.1-py2.py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page