Add support for .Net asynchronous/distributed thread tracking via ActivityId. #9

Open
wants to merge 2 commits into from

3 participants

@optimiz3

.Net supports logical thread ids for asynchronous operations that may execute over multiple thread pool threads. This is provided via the System.Diagnostics.Trace.CorrelationManager.ActivityId property. .Net always ensures the ActivityId gets propagated across Begin/End async calls as well as QueueUserWorkItem operations. It is often a best practice to also include the ActivityId over network RPC operations so the logical thread/operation can be tracked in a distributed system.

This commit adds the ActivityIdLayoutRenderer to simply write this value out if the user desires. It is derived from the original GuidLayoutRenderer. Much appreciated!

@jkff

Wow, thanks - I never heard of this ActivityId property. It will probably turn out very useful for me some day :)

@optimiz3

Happy to help! It's incredibly useful when analyzing and merging massive amounts of logs from a cluster.

@jkff

Yep, I'm actually using a thingie of my own for that; in case you're interested: https://github.com/jkff/greg , http://code.google.com/p/greg/ (with an NLog appender of course - however the .NET version belongs to my employer; only Java and Haskell I opensourced)

@dan-turner

Why hasn't this been merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment