Your official information source from the .NET Web Development and Tools group at Microsoft.
In 4.5 we introduced ETW tracing for WCF. In the past couple of months we have been trying to establish some common tools that can be used to debug and analyze ETW traces from WCF. We have a large number of tools that allow ETW analysis and the one aspect we wanted to do was to allow activity correlation which WCF uses extensively. Folks who have already used ETW in its full capacity already know about ETW activities and how they are propagated. Those of you who don't, this FAQ: Common Questions for ETW and Windows Event Log should be a good start point. Others who just want to jump in, hop over to the tool page here -http://svcperf.codeplex.com/
Pros of ETW
Some of the not so great features are
Despite these issues ETW offers one of the most robust tracing infrastructures on the platform. With that in mind we build our End-to-End(E2E) tracing for WCF. We needed to make multiple layers understand and consistent with our E2E model. We also needed to be able to correlate a large number of scenarios from our transports all the way to our dispatchers. We have large number of pumps in multiple layers and being extremely asynchronous means that you lose the ability to depend on things like TLS and ExecutionContext etc. With these in mind we choose a model where we explicitly flow our correlation across layers and use it when stamping our events. This also means that we need to be able to stitch causality chains for request analysis.
The other more popular ETW tools like Xperf and WPA have a good amount of analysis capability already built in them but they are not tuned for statistical analysis of data. For e.g. given a trace how do you find out which are your slow requests or how to obtain a distribution of your request processing times. These kinds of question were better answered with SQL like queries. That said there are log parsers that have this capability but we wanted to work on raw ETL and this is where SvcPerf comes into play. Besides being a quick ETL viewer it also is a query engine built on top of Tx (LINQ over Traces).
In the above screen shot you can see that Activities are correlated for you and the ETW fields like ActivityID and RelatedActivityID are can be directly queried.
If you want to just give the tool a try you can get it from here. SvcPerf.exe (It is self-signed and will give you a warning but if you want you can try to compile the source as well provided you remove the strongname.).
To collect the trace use logman with the WCF provider and you also need the manifest so that events can be decoded. Refer - http://svcperf.codeplex.com/wikipage?title=How%20do%20I%20collect%20an%20ETL%20trace%20for%20WF%2fWCF%3f&referringTitle=FAQs
In the coming posts I will try to take up some simple scenarios where this tools might help in analysis.
Very useful tool for WCF developers. Nice work ;)
Do you have any sample ETL file to share?
You can find details of the sample http://blogs.msdn.com/b/sajay/archive/2013/01/23/sample-etw-trace-for-wcf.aspx
or download the sample trace and load the manifest from the Microsoft.Windows.ApplicationServer.Applications.45.man from the framework folder.
It'd be really nice to get some better ETW support in the .NET Framework. The EventSource is an alright first start but lacks the channel support to get good visibility within Event Viewer. So much potential folks - someone please pick up the logging and tracing story and make it better - ship a few CTPs so the community can feedback into it too while you are at it!
We are very aware of lack of channels and Activity support in EventSource. To give you some insight WCF doesn't use event source and instead has its own ETW/Activity implementation since it has been around before 4.5. That said a lot of the implementation details are quite generic to E2E allowing different layers to participate is something that really has to be considered and unifying this across stacks is something we want.