Magento Module: Order Monitor

A low-level, event-based order process flow monitor.

Details

This module was developed to help track intermittent order failures in a multi-node environment. No errors were being collected in log files. The errors were not coming from the payment gateway, and not from form validation, but somewhere in between. No traditional means for tracing could be implemented easily, so a more autonomous tool had to be built for probing the system in real-time.

It works by establishing an "event sequence profile", where known order process events are defined in a specific sequence and, if any event in the sequence is not reached, a notification is sent to a subscriber.

Screenshots

Monitor configuration options

Monitor email notification sample

Technical Features

Code Sample

public function trackEvent(Varien_Event_Observer $observer)
{
    try {
        if (!$this->_enabled) {
            return;
        }
        $event      = $observer->getEvent()->getName();
        $eventData  = $this->_getEventData($event, $observer->getEvent());
        $recordId   = $eventData['record_id'];

        /* @var $record Groove_OrderMonitor_Model_Record */
        $record = $this->_storage->load($recordId);

        $record->setId($recordId)
            ->setLastEvent($event)
            ->setUpdatedAt(time())
            ->addEvent($event, $eventData);

        $this->_storage->save($record);
    } catch (Exception $error) {
        Mage::logException($error);

        $this->_notify($error);
    }
}

Static Analysis