-
Notifications
You must be signed in to change notification settings - Fork 67
Use W3C trace Id format for Activities that do not have parents #952
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple comments left.
@@ -12,6 +12,7 @@ | |||
internal static class ClientServerDependencyTracker | |||
{ | |||
private const string DependencyActivityName = "Microsoft.AppInsights.Web.Dependency"; | |||
private const string AuxiliaryActivityName = nameof(ClientServerDependencyTracker); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuxiliaryActivityName - Where is this used?
if (currentActivity == null) | ||
{ | ||
activity.SetParentId(telemetry.Id); | ||
activity.SetParentId(StringUtilities.GenerateTraceId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need to stop this in EndTracking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, it's stopped on line 81
|
||
internal static class ActivityExtensions | ||
{ | ||
public static Activity UpdateParent(this Activity original, string newParentId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unittest this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@MS-TimothyMothra could you please have a look? |
We are going to gradually enable W3C support in ApplicaitonInsights.
While the details and backward compatibility conditions are still not clear, we want to make sure that customers have enough time to transition to W3C format and this change is the first step in this transition.
This change generates Activity RootId in the format of W3C traceId when there are no parents.
I.e. if the service has received Request-Id (or legacy) header from upstream, it will use it, no matter which format it follows.
However, if there were no such header in the incoming request, the new operation id will comply with W3C spec for traceId.
This is a temporary workaround that could be removed once W3C supported in .NET (Activity).
Sampling tests shows that distribution of sampling score for the new traceId generation algorithm is uniform.