Skip to content

Commit 758330a

Browse files
W3C trace headers added per work item #37
1 parent d44878d commit 758330a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/EventSourcingOnAzureFunctions.Common/Notification/EventGridNotificationDispatcher.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public sealed class EventGridNotificationDispatcher
4242
private static HttpClient httpClient = null;
4343
private static HttpMessageHandler httpMessageHandler = null;
4444

45-
// trade http header constants
45+
// trace http header constants
4646
public const string TRACE_HEADER_PARENT = "traceparent";
4747
public const string TRACE_HEADER_STATE = "tracestate";
4848

@@ -616,15 +616,23 @@ public static string MakeTraceParent(string correlationIdentifier, string causat
616616
// turn it into an 16-byte array of lowercase hex
617617
correlationIdentifier = StringToByteArray(16, correlationIdentifier);
618618
}
619+
else
620+
{
621+
correlationIdentifier = @"00000000000000000000000000000000";
622+
}
619623

620624
if (! string.IsNullOrWhiteSpace(causationIdentifier ) )
621625
{
622626
// turn it into an 8-byte array of lowercase hex
623627
causationIdentifier = StringToByteArray(8, causationIdentifier);
624628
}
629+
else
630+
{
631+
causationIdentifier = @"0000000000000000";
632+
}
625633

626634
// If not able to make a header, return a "null" one
627-
return $"{version}-00000000000000000000000000000000-0000000000000000-{traceFlags}";
635+
return $"{version}-{correlationIdentifier}-{causationIdentifier}-{traceFlags}";
628636
}
629637

630638

0 commit comments

Comments
 (0)