BugLogHQ: New 'Rules' feature.
I'm taking a moment before my first session for the day at MAX 2007 (by the way, AIR rocks!!) to write up a brief post about a new feature in BugLogHQ that I happen to like very much. I'm talking about the support for an extensible and configurable set of 'rules' to be applied to each bug report as it is received.
The initial motivation for developing BugLogHQ was that I did not wanted to be bothered with a million emails every time an application broke, however, now with BugLog I need to either pay attention to the RSS feed or go to the BugLog front end and keep it open on a separate browser window to see when a bug report arrives. That means that if I don't actively check for new bug reports then I do not know if something has happened.
Is beacause of that that I wanted to add a feature so that the application will notify me via email whenever some special condition happened, like for example, whenever a bug with a severity code of 'FATAL' came from some super critical application or things like that. Happily, now BugLog does that by applying a set of "rules" to each new message as it is received.
A Rule is basically a process that is run for every report. Each rule may decide to take some action or not based on the content of the bug report received. Rules are implemented as individual CFCs that extend a base class (baseRule.cfc) Each rule must overwrite at least 2 methods (a CFInterface would have been handy here): Init() and ProcessRule().
The init() method is called whenever the rule is instantiated and its parameters must be whatever that rule requires as its settings. The ProcessRule() method is where the magic happens. This method receives a rawEntryBean.cfc instance with all the details received from application that submit the bug report. ProcessRule can then look into the rawEntryBean and decide if it needs to do something or not. These processes can be simple actions, like sending an email if the bug comes from X application, or can be something more complex such as only sending an email if the number of bugs received in the last X minutes is greater than a given threshold. Having the rules defined as independent CFCs allows developers to extend the buglog rules system to anything they want, and since each rule is created so that it may have any number of configuration arguments, that gives the whole thing even more flexibility. For example, a rule may only need a "recipientEmailAddress" parameter, while other rule may need much more settings than that.
Also, bugLog can create as many instances of the same rule as you want, each instance with different parameters. For example, if I have a rule that sends an email whenever a critical bug is received from a certain application, and the parameters are the email address and the application code; I can create separate instances so that only the people responsible for their own applications will be notified via email.
The way the rules are configured is by an XML file on the bugLog/extensions directory. The name of the configuration file is extensions.xml. The following is a sample extensions config file:
<bugLogExtensions>
<rules>
<rule name="mailAlert">
<!-- sender/recipient of email -->
<senderEmail>info@xxx.com</senderEmail>
<recipientEmail>oarevalo@xxx.com</recipientEmail>
<!-- severity code to trigger the alert, leave empty for any severity code -->
<severityCode>fatal</severityCode>
<!-- application to trigger the alert, leave empty for any application -->
<application></application>
<!-- keywords list to trigger the alert -->
<keywords></keywords>
</rule>
<rule name="frequencyAlert">
<!-- sender/recipient of email -->
<senderEmail>info@xxx.com</senderEmail>
<recipientEmail>oarevalo@xxx.com</recipientEmail>
<!-- number of bugs that will trigger the rule -->
<count>5</count>
<!-- length of time (in minutes) in which the bugs for the rule trigger will be counted -->
<timespan>1</timespan>
</rule>
</rules>
</bugLogExtensions>
This file declares 2 rules: mailAlert and frequencyAlert, implemented by /buglog/extensions/rules/mailAlert.cfc and /buglog/extensions/rules/frequencyAlert.cfc respectively. The first one sends an email each time a bug report matching the given conditions is received, and the second one sends an email whenever the amount of bugs received on the last X minutes is greater than a given number.
Currently this is the only way of setting up and configuring the rules, but for the next release of bugLog I'd like to add some sort of graphical interface to more easily configure the rules.
All the code is on the subversion repository at riaforge, on the main trunk; I anyone wants to play with this, feel free to grab a copy and let me know if you have any questions or problems, or even better, if you'd like to create and contribute with your own rules to the project.
Well, for now, I'm off to my next session at MAX!!
Have fun!
There are no comments for this entry.
[Add Comment]