I deployed this blog about a week ago. Since then there has been little traffic, mostly because I have not promoted it and I have also been working on a bunch of other content and such. Since I also just needed to just get it out the door and running I have not spent a lot of time testing for performance. This blogging app is based off of Zend_Application and as such there is a bit of overhead. Since I was not expecting traffic to be that heavy I was not (and am not) overly concerned about snappy performance at this point. As long as the page loads and displays in the browser I’m fine with it.
One of my goals with this blog is to show real life examples of how to use Zend Server. While I am not overly concerned about the performance of this blog for the time being I am still monitoring it to make sure that it performs well. That means Monitoring.
However, Monitoring is really not all that beneficial if you don’t know what is happening on your server. To get around that issue, Monitoring has a feature where you can send an email to one or more email addresses when an event occurs, such as slow page load times or a fatal error. This is great… except that people ignore emails. We’re conditioned to. As great as Spam in a can is (I’m not Hawaiian, but Spam is a delicacy IMHO), Spam in the Inbox has conditioned us to ignore the things we’re not interested in. And, to be honest, we’re not interested in fixing problems. We’d rather be doing new and cool things.
Task driven development is part of the Agile process. Test driven development is too, but I’m going to talk about Task driven development. What that basically means is that if there is something to be done, a task is created and it is worked on by the next available developer. The benefit of this is that with short, well defined tasks, it is easy to track the progress that is being made on a project. That is why task driven development is part of Zend Studio.
“What? I thought you were talking about Monitoring?” Yep. Still am. What I am going to show you is how you can integrate Monitoring with Zend Studio using Gmail to make you a better developer.
First, we need to set up our Gmail account. Log in with your email address and go to Gmail’s “Settings” -> “Labels” section and create a new label called “Task”.
Next, click on “Filters”. Create a new filter and enter a “From” address; [email protected] in my case. The actual email address is relatively unimportant, and doesn’t really need to exist, as mine doesn't. What is important is that you can match it up with the “From” address that Monitoring will use, which we will set up later on. Click on “Next Step” and tell it to apply the label “Task” to any message coming in from that email address.
Zend Studio has the ability to connect in with Mylyn task connectors. To access this, go to the Planning perspective in Zend Studio. On the right hand side you should see a View window that says “Task Repository”. From there you can right click on the screen and select “Add Task Repository”. You will be asked to choose a specific type of task repository. I will use the Gmail type. If you don’t have the Gmail connector installed click on “Install More Connectors” and install it from there. You may need to restart Studio (“may” meaning you will need to). You may (same thing) need to create a TaskTop account. It seems to be free.
Once you’re back up, go back to the same view and get to the “Add Task Repository” window again. This time select Gmail as the repository type. Enter in your email address and your password, but set “Task” as the label. Click Finish.
Then you will probably get a window popping up asking if you want to configure a query. Of course you do. Set the title of the query as "Task" and then choose the label that you want to query by. This should be the new label that you had entered earlier on.
Next we will go into the Zend Server admin GUI. Select “Server Setup” and then “Monitor”. From there you should see some mail server settings. The sender email address is the one you set up for the “from” address in the Gmail filter; [email protected] in my case. Click Save.
From there go to the “Rule Management” tab and select the rule that you want to receive alerts for. Scroll down to “Step 2: Event Action”. Enter in your Gmail email address here, save it and restart PHP. I chose Slow Request Execution. And since slow requests are difficult to debug I also chose to enable Code Tracing when a slow request occurs.
Now you wait for an event to occur. Me? I just refreshed the home page. (I may have some optimizations to do). Go back to the Planning perspective and right click on the task list and click “Synchronize”. You should see a new task listed. Double click on it and you should see something like the following.
Now, rather than using your email program and ignoring messages that come in, you can have them directly integrated into a simple task management system.
Create Label in Gmail called "Task" with a filter for the "From" address, set up in Zend Server
Add Mylyn connector for Gmail and set up to use your Gmail account with the label "Task"
Set up Zend Server Monitoring to send monitoring events from the "From" address
For a specific event set it to send an email to your Gmail account
Wait for events to come in.