Skip to content

Commit

Permalink
trace2: add default thread name value of "main"
Browse files Browse the repository at this point in the history
The TRACE2 convention for thread naming is for each child process's main
thread of execution to be named "main." In GCM, however, we encountered an
issue with our UI Helper exes - their main threads of execution are named
AppMain.

To temporarily work around this issue, we default the thread name for all
TRACE2 events to "main" (rather than changing GCM's process names). This
will do for our current events, which are all called from the main thread
of execution. However, it is important to note that future events (i.e.
regions) will require deeper thought around the GCM/TRACE2 process model,
as they will be called on threads from .NET's ThreadPool rather than the
main thread of execution.
  • Loading branch information
ldennington committed Feb 17, 2023
1 parent 6b2459c commit 2476614
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shared/Core/Trace2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ public abstract class Trace2Message
[JsonProperty("sid", Order = 2)]
public string Sid { get; set; }

// TODO: Remove this default value when TRACE2 regions are introduced.
[JsonProperty("thread", Order = 3)]
public string Thread { get; set; }
public string Thread { get; set; } = "main";

[JsonProperty("time", Order = 4)]
public DateTimeOffset Time { get; set; }
Expand Down

0 comments on commit 2476614

Please sign in to comment.