forked from DataDog/dd-trace-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use DiagnosticSource to instrument ASP.NET Core (DataDog#611)
* clean up env vars, project properties, and unused references * update 3rd-party license file * changes to IScope, ISpan, and IDatadogTracer interfaces * disable current AspNetCoreMvc2 and AspNetCoreMvc3 integrations * add minimal solution * subscribe to DiagnosticSource events from Tracer if enabled * add startup hook * add Datadog.Trace.DiagnosticListeners * add DiagnosticSource configuration * fix URLs to moved repositories * update notes in deprecated NuGet package * fix nuget package comment * remove redundant null coalescing operator * use System.Net.Http from the GAC when targeting net4*, use the nuget package when targeting netstandard2.0 * support ASP.NET Core running on .NET Framework * add logs * remove the build dependency on Datadog.Trace.dll and Datadog.Trace.ClrProfiler.Managed.dll in sample app * fix comment * don't try to write to stderr * remove tailing whitespace * call Tracer.StartDiagnosticObservers from the auto-instrumentation startup hook * stop previous observers when starting new ones in StartDiagnosticObservers() * convert GetListenerName() to property ListenerName * check if there is a parent span earlier to avoid extra work * reorder methods into expected execution order * reference System.Diagnostics.DiagnosticSource 4.4.1, the version used by Microsoft.AspNetCore.* 2.0.0 * move the check for available System.Diagnostics.DiagnosticSource into Tracer * remove remaning sample apps and solution items from the "minimal" solution * remove integration tests for deleted integrations * add missing System.Net.Http references * fix aspnet core mvc integration tests * always save moduel metadata for Microsoft.AspNetCore.Hosting to ensure the startup hook is executed on ASP.NET Core * handle Microsoft.AspNetCore.Diagnostics.UnhandledException event to capture exceptions in ASP.NET Core (not MVC) * use ordinal string compare * stop handling Microsoft.AspNetCore.Mvc.AfterOnActionExecuted since we now have Microsoft.AspNetCore.Diagnostics.UnhandledException * add test app for "pure" ASP.NET Core 3.1 (no MVC) * optimize Log.IsEnabled() calls (only cache the result if it will be used very often) * add checks for error flag and error type in AspNetCoreMvc integration tests * rethrow exceptions in SubmitRequest() so tests fail * add missing netcoreapp3.1 targets in Windows * rename SpanExpectation.Detail() to ToString() and other code clean up * fix WebServerSpanExpectation and AspNetCoreMvcSpanExpectation to properly validate the http status code and http method, and fix the tags for http status code and http method * rewrite SubmitRequest() to use HttpClient instead of WebRequest * stop EntityFramework6x.MdTokenLookupFailure from including Test.Common.props * change wording in sample app * target netcoreapp3.1 in PrepareRelease (resolves nuget restore error) * don't configure an exception handler * add test for 404 * change the default values to unbreak the GraphQL tests
- Loading branch information
1 parent
7aba67d
commit e21a59a
Showing
62 changed files
with
1,327 additions
and
1,424 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ces.InfiniteRecursionCrash/AssemblyResolveMscorlibResources.InfiniteRecursionCrash.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) "> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" $(TargetFramework.StartsWith('netcoreapp')) "> | ||
<PackageReference Include="System.Net.Http" Version="4.3.4" /> | ||
</ItemGroup> | ||
</Project> |
6 changes: 6 additions & 0 deletions
6
reproductions/EntityFramework6x.MdTokenLookupFailure/Directory.Build.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<IsPackable>false</IsPackable> | ||
<GenerateDocumentationFile>false</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
</Project> |
7 changes: 7 additions & 0 deletions
7
...ttpMessageHandler.StackOverflowException/HttpMessageHandler.StackOverflowException.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) "> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" $(TargetFramework.StartsWith('netcoreapp')) "> | ||
<PackageReference Include="System.Net.Http" Version="4.3.4" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net452;net461;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks> | ||
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<Import Project="..\Test.Common.props" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace Samples.AspNetCore31 | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
samples/Samples.AspNetCore31/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:54570", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"profiles": { | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": false, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
|
||
"CORECLR_ENABLE_PROFILING": "1", | ||
"CORECLR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}", | ||
"CORECLR_PROFILER_PATH": "$(ProjectDir)$(OutputPath)profiler-lib\\Datadog.Trace.ClrProfiler.Native.dll", | ||
|
||
"DD_DOTNET_TRACER_HOME": "$(ProjectDir)$(OutputPath)profiler-lib", | ||
"DD_INTEGRATIONS": "$(ProjectDir)$(OutputPath)profiler-lib\\integrations.json" | ||
}, | ||
"use64Bit": true, | ||
"nativeDebugging": true | ||
}, | ||
"Samples.AspNetCore31": { | ||
"commandName": "Project", | ||
"launchBrowser": false, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
|
||
"CORECLR_ENABLE_PROFILING": "1", | ||
"CORECLR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}", | ||
"CORECLR_PROFILER_PATH": "$(ProjectDir)$(OutputPath)profiler-lib\\Datadog.Trace.ClrProfiler.Native.dll", | ||
|
||
"DD_DOTNET_TRACER_HOME": "$(ProjectDir)$(OutputPath)profiler-lib", | ||
"DD_INTEGRATIONS": "$(ProjectDir)$(OutputPath)profiler-lib\\integrations.json" | ||
}, | ||
"nativeDebugging": true, | ||
"applicationUrl": "http://localhost:54571" | ||
} | ||
} | ||
} |
Oops, something went wrong.