Open helsaawy opened 1 year ago
What is the motivation behind supporting thread activity ID? Our previous thinking has been this doesn't give much value given the nature of goroutines, and it makes more sense (and is more idiomatic Go) to just carry activity ID around in a context.
This commit is contains several related changes that ultimately allow ETW events to set their activity ID to the current thread's value. By setting the thread's activity ID, win32 API calls from that thread will be able to access it and either continue using it or set it as the related activity ID, improving tracing on Windows.
Update mkwisyscall to import arbitrary other packages, so generated functions can types defined elsewhere.
Switch ETW functions to use
guid.GUID
instead ofwindows.GUID
.Add convenience
IsEmpty
function for GUIDs.Add
EventActivityIdControl
function to manipulate the thread's activity ID, and related*ThreadActivityID
functions to set the thread activity ID to a non-empty value.Update
writeEventRaw
to only pass (related) activity ID toeventWriteTransfer
if they are non-empty.This is not a breaking change, since related activity ID will remain the same, and the activity ID will only be changed when not specified if
InitializeThreadActivityID
orSetThreadActivityID
are called before-hand.