Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at RIA Unleashed (Nov. 2009) with:

Parsing Fusion Reactor Alert Emails Into A Usable Data Structure

By Ben Nadel on
Tags: ColdFusion

At work, we use Fusion Reactor to help monitor the health and performance of our ColdFusion J2EE applications. When certain application metrics reach a given threshold, Fusion Reactor sends out an Email Alert with a massive amount of data including a full stack-trace and a list of all the running requests. This email alert has been invaluable and I thank my lucky stars that such a product even exists! But, I think it could be better; or rather, there are ways that it could be made more readable. And, to start playing around with some of these ideas, I thought a great first step would be to parse the raw email content into a usable data structure.

Project: View the FusionReactorAlert.cfc project on my GitHub account.

The FusionReactorAlert.cfc is a ColdFusion component that takes the raw email content and provides methods for accessing the running requests, threads, CFThreads, and an aggregate report of all the data in structured format. Once instantiated, the ColdFusion component provides the following public methods:

  • getColdFusionThreads() :: array
  • getJavaThreads() :: array
  • getReport() :: struct
  • getRunningRequests() :: array

The "report" is a structure that contains two ColdFusion query objects:

  • runningRequests
  • coldfusionThreads

By default, the running-requests query is ordered by request duration (DESC); however, since it's a ColdFusion query, you can run your own query-of-queries to order it as you see fit. The running-requests query also contains a query column, "thread," that embeds the Java thread directly in the request query record.

Here is a screenshot from the "Example" from the GitHub project. It just dumps out the two queries contained within the report:


 
 
 

 
Fusion Reactor alert email report.  
 
 
 

The parsing in this ColdFusion component is based on the way that GMail reports the "original" email content. I am not sure if this "original" data is consistent across various email clients; or, if this is just how you can expect it in a GMail context. Furthermore, I built this using Fusion Reactor alerts from a single ColdFusion application; as such, I am sure there is going to be variation in formatting that I have not accounted for.

Anyway, now that I can get my Fusion Reactor alerts in structure format, I should be able to build some tooling around making the emails more readable and actionable.




Reader Comments

@All,

After parsing the Fusion Reactor Alert emails into a data structure, I wanted to see if I could create a simple Online Viewer for said emails. Over the weekend, I was able to translate my FusionReactorAlert.cfc into an AngularJS factory; this allowed me to create an online viewer that exists entirely on GitHub (powered exclusively by HTML, CSS, and JavaScript):

http://www.bennadel.com/blog/2525-HTML-And-JavaScript-Viewer-For-Fusion-Reactor-Alert-Emails.htm

It's just a first attempt; but, I've already used it today :)

Reply to this Comment

Hi Ben! That's awesome stuff you did! Just curious if we can reproduce this by using our new app mailparser.io!? You can create a free 30-day trial at http://mailparser.io

Reply to this Comment

@Moritz,

That's an interesting question. I have not heard of mailparser before. I couldn't really find any docs on your site. From the few screenshots on the homepage, it looks like the rules may be a bit too simple for my use case. If you look at the code for the component:

https://github.com/bennadel/Fusion-Reactor-Alert/blob/master/lib/FusionReactorAlert.cfc

... it normalizes the data before parsing; then, it uses regular expressions to locate, and break up the data, which is subsequently transforms into data structures with standardized keys.

Perhaps you can shed some insight into how to parse complex emails; or provide a link to the docs for mailparser? Thanks!

Reply to this Comment

@Ben,
the pattern matching with regular expressions is currently missing. We had this request already from some clients and we want to develop taht very soon. The rest (normalizing, cleaning, etc.) should be fine with mailparser.io.

If you like, give it a try. The trial is free and we won't bother you if you don't want to use it.

Reply to this Comment

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Oops!
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.