问题
What is the best pattern for instrumentation. I have an application and i want to be able to track metrics on everytime a users does a number of functions in the app (brings up a form, views a certain feature, etc) but i dont want to have code all over the application that is doing this instrumentation. what are my options here?
At the end of the day, i want to be able to aggregate data across multiple users listing out metrics.
回答1:
I've been investigating doing something very similar (for an anonymous stats-collection library... kind of like Google Analytics, but for desktop apps. If you're interested, check out the GUI mockup here.)
Anyhow... for .NET, I've been looking at a few aspect-oriented libraries that provide dynamic and static instrumentation. I'm not sure whether they'll fit the bill yet (I haven't written any code yet; I've just started researching the libs). But here are a few prospects:
http://dotspect.tigris.org/
http://setpoint.codehaus.org/
http://www.springframework.net/docs/1.2.0-RC1/reference/html/aop.html
http://www.castleproject.org/aspectsharp/
http://www.postsharp.org/
Good luck!
来源:https://stackoverflow.com/questions/228553/winforms-instrumentation