With all the interest around creating custom OpsMgr 2007 solutions, I thought I'd write a simple code sample to help app development teams instrument their code to further gain value from OpsMgr 2007. Keep in mind the attached sample is just that - a sample (not product ready code), but it paints a clear picture.
Instrument business functions in your .NET applications so that you can track the performance of each business function. While in this example, I have only demonstrated how to capture and track the duration it takes for each function to execute, you can build on this idea to include a variety of quality measures, such as, CPU utilization, memory utilization, number of failures, who executed the function, number of times it was executed in a given period and so on.
How to use the sample:
Click here for the sample code
What is the sample doing?
Every time you click on the “Execute Method”, you are simulating the execution of a business function called "GetCustomerProfile", in which, for example, you could be loading the profile of one of your eCommerce customers. The idea is to publish (i.e. instrument) key areas of the application as performance counters so that it can be monitored by OpsMgr 2007/MOM 2005.
So how could this be useful? Just to give you a single example, imagine if you could receive an alert that logins on your eCommerce website are taking longer than normal and you could respond to it immediately before your customers left the site to purchase the product elsewhere?
That's just one example of how instrumenting your code can reduce down time and increase efficiency but with a little imagination I'm sure you can come up with countless ways this can improve your business.
David Raskino | Microsoft Consulting Services