1 # ETW Exporter multithreaded context propagation example
5 This example shows how to pass context from main dispatcher thread to worker threads.
6 While this example is convenient to run in Visual Studio with ETW exporter, the same
7 logic should apply to any other exporter. Only the initial portion that obtains ETW
8 Tracer is unique to ETW, the rest can be reused.
10 ## How to debug events in Visual Studio 2019 or newer
12 Specify your component instrumentation name, which should match the destination ETW
13 Provider Name or GUID. Example uses "OpenTelemetry-ETW-TLD" for the instrument /
18 - navigate to `View -> Other Windows -> Diagnostic Events...`
19 - click `Configure...` gear on top.
20 - specify `OpenTelemetry-ETW-TLD` in the list of providers to monitor.
22 - `Diagnostic Events` view shows you the event flow in realtime.
24 ## Explanation of the code flow
26 `main` function acts as a dispatcher to manage thread pool called `pool`. `beep_bop`
27 span is started in the `main`. Then in a loop up to `kMaxThreads` get started
28 concurrently. Each thread executing `beep` function with a parent scope of `main`.
29 `beep` subsequently calls into `bop` function, with a parent scope of `beep` span.
30 Entire execution of all threads is grouped under the main span called `beep_bop`.
31 At the end of execution, the `main` function joins all pending threads and ends