Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Support W3C incoming headers in opt-in mode #735

Merged
merged 8 commits into from
Aug 21, 2018

Conversation

lmolkova
Copy link
Member

@lmolkova lmolkova commented Aug 7, 2018

Implements w3c distributed tracing standard.

This change enables opt-in W3C support via settings.
To enable it, set ApplicationInsightsServiceOptions.RequestCollectionOptions.EnableW3CDistributedTracing to true and provide options to the AddApplicationInsights telemetry

This change ensures W3C ids are set on the telemetry (operationId, parentId and Id). 'legacy' ids are set in custom dimensions whenever they are different from the W3C ones.

This change requires UI queries change to support querying for custom dimensions for the cases when operation id or parent id do not match on the legacy-W3C boundary.

This PR depends on changes in DependencyCollector that will be shipped in 2.8.0-beta1 (microsoft/ApplicationInsights-dotnet-server#945) and cannot be merged until that. Sharing it to get the early feedback.

@cijothomas @reyang @SergeyKanzhelev please review

@TimothyMothra TimothyMothra added this to the 2.5.0 milestone Aug 8, 2018
@lmolkova lmolkova changed the title [Do not merge] Support W3C incoming headers in opt-in mode Support W3C incoming headers in opt-in mode Aug 16, 2018
@lmolkova
Copy link
Member Author

ready for review @cijothomas ;)

@@ -65,6 +65,7 @@
<PackageReference Include="System.Collections.Immutable.Analyzers" Version="1.2.0-beta2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.0" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.4.1 -> to 2.5.0-beta1 - please update this as well.

// W3C
if (this.enableW3CHeaders)
{
SetW3CContext(httpContext.Request.Headers, activity, out sourceAppId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we log all the header values in Eventsource with Verbose logging level? It'll help with support tickets.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea, I also wonder if it is secure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AS discussed, lets not do it now. We can ask Cx to add TI to dump headers, if a need arises.

}

[Fact]
public void OnHttpRequestInStartWithW3CHeadersAndRequestIdIsTrackedCorrectly()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename unit test to indicate OnBeginRequest bein tested

@cijothomas cijothomas merged commit 17cc5de into develop Aug 21, 2018
@lmolkova lmolkova deleted the lmolkova/supportW3COnCore branch January 3, 2019 03:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants