Skip to content

Improve span validation for automatic instrumentation of outbound HTTP calls#780

Merged
zacharycmontoya merged 9 commits into
masterfrom
zach/fix/outbound-scope-fix
Jul 8, 2020
Merged

Improve span validation for automatic instrumentation of outbound HTTP calls#780
zacharycmontoya merged 9 commits into
masterfrom
zach/fix/outbound-scope-fix

Conversation

@zacharycmontoya

@zacharycmontoya zacharycmontoya commented Jul 2, 2020

Copy link
Copy Markdown
Contributor

This PR improves the Datadog.Trace.ClrProfiler.ScopeFactory.CreateOutboundHttpScope helper method, used by both the WebRequest integration and the HttpMessageHandler integration, in the following ways:

  1. Removes several possible locations for a NullReferenceException to occur in the method
  2. Adds a more robust check on the parent span so that the HTTP span de-duplication logic (e.g. automatic instrumentation from nested HttpMessageHandler objects) will only consider spans created by automatic instrumentation, not custom spans

@DataDog/apm-dotnet

@zacharycmontoya zacharycmontoya added type:bug area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) labels Jul 2, 2020
@zacharycmontoya
zacharycmontoya requested a review from a team as a code owner July 2, 2020 19:27
@zacharycmontoya zacharycmontoya self-assigned this Jul 2, 2020
…strumentation spans generated.

Modify the CreateOutboundHttpScope to relax the instrumentation name for the Http de-duplication logic.
Comment thread src/Datadog.Trace.ClrProfiler.Managed/ScopeFactory.cs Outdated
…by using the static string.Equals method and specifically checkingthe integrationName argument. Additionally, calculate the httpUrl only once.
Comment thread src/Datadog.Trace.ClrProfiler.Managed/ScopeFactory.cs Outdated
Comment thread src/Datadog.Trace.ClrProfiler.Managed/ScopeFactory.cs Outdated
zacharycmontoya and others added 2 commits July 7, 2020 14:32
…ent to understand if the HTTP span was automatically generated. Also, save the result of UriHelpers.CleanUri call so it is only called once.
Comment thread src/Datadog.Trace.ClrProfiler.Managed/ScopeFactory.cs
@zacharycmontoya
zacharycmontoya merged commit 11e721b into master Jul 8, 2020
@zacharycmontoya
zacharycmontoya deleted the zach/fix/outbound-scope-fix branch July 8, 2020 15:09
@zacharycmontoya zacharycmontoya added this to the 1.18.2 milestone Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:automatic-instrumentation Automatic instrumentation managed C# code (Datadog.Trace.ClrProfiler.Managed) type:bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants