Skip to content

Commit

Permalink
Manually revert http context integration (DataDog#455)
Browse files Browse the repository at this point in the history
* Revert AspNetCoreMvc2 changes and disable HttpContext integration

* Include load tests with revert

* Use correct top level operation name

* itchy finger

* Add requires profiling flag

* Use mvc as top level for core integration test

* Make sure load test only runs locally for the moment.

* build new repro, small refactor
  • Loading branch information
colin-higgins authored Jul 19, 2019
1 parent dfdbfac commit 5fef5d3
Show file tree
Hide file tree
Showing 13 changed files with 666 additions and 126 deletions.
13 changes: 13 additions & 0 deletions Datadog.Trace.sln
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackExchange.Redis.StackOv
{C0C8D381-D6B9-4C76-9428-F40F2FA93A9A} = {C0C8D381-D6B9-4C76-9428-F40F2FA93A9A}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetMvcCorePerformance", "reproductions\AspNetMvcCorePerformance\AspNetMvcCorePerformance.csproj", "{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -640,6 +642,16 @@ Global
{FA487690-E88C-4A57-9187-B71CB70C1AAE}.Release|x64.Build.0 = Release|x64
{FA487690-E88C-4A57-9187-B71CB70C1AAE}.Release|x86.ActiveCfg = Release|x86
{FA487690-E88C-4A57-9187-B71CB70C1AAE}.Release|x86.Build.0 = Release|x86
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Debug|Any CPU.ActiveCfg = Debug|x86
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Debug|x64.ActiveCfg = Debug|x64
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Debug|x64.Build.0 = Debug|x64
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Debug|x86.ActiveCfg = Debug|x86
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Debug|x86.Build.0 = Debug|x86
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Release|Any CPU.ActiveCfg = Release|x86
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Release|x64.ActiveCfg = Release|x64
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Release|x64.Build.0 = Release|x64
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Release|x86.ActiveCfg = Release|x86
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -685,6 +697,7 @@ Global
{DAD5E1F2-A158-4624-9FB4-C89E98DFF0D4} = {550AE553-2BBB-4021-B55A-137EF31A6B1F}
{43782238-E7BB-49D0-9541-1121DACA6EB5} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{FA487690-E88C-4A57-9187-B71CB70C1AAE} = {550AE553-2BBB-4021-B55A-137EF31A6B1F}
{191824FD-94CA-4FC6-9CA2-EC8DC322DB3E} = {550AE553-2BBB-4021-B55A-137EF31A6B1F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}
Expand Down
12 changes: 4 additions & 8 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ for config in Debug Release ; do
for sample in Samples.AspNetCoreMvc2 Samples.Elasticsearch Samples.Elasticsearch.V5 Samples.ServiceStack.Redis Samples.StackExchange.Redis Samples.SqlServer Samples.MongoDB Samples.HttpMessageHandler Samples.Npgsql Samples.GraphQL ; do
dotnet publish -f netcoreapp2.1 -c $config samples/$sample/$sample.csproj
done

dotnet publish -f netcoreapp2.1 -c $config reproductions/OrleansCrash/OrleansCrash.csproj

dotnet publish -f netcoreapp2.1 -c $config reproductions/DataDogThreadTest/DataDogThreadTest.csproj

dotnet publish -f netcoreapp2.1 -c $config reproductions/HttpMessageHandler.StackOverflowException/HttpMessageHandler.StackOverflowException.csproj

dotnet publish -f netcoreapp2.1 -c $config reproductions/StackExchange.Redis.StackOverflowException/StackExchange.Redis.StackOverflowException.csproj

for sample in OrleansCrash DataDogThreadTest HttpMessageHandler.StackOverflowException StackExchange.Redis.StackOverflowException AspNetMvcCorePerformance ; do
dotnet publish -f netcoreapp2.1 -c $config reproductions/$sample/$sample.csproj
done

dotnet msbuild Datadog.Trace.proj -t:RestoreAndBuildSamplesForPackageVersions

Expand Down
29 changes: 0 additions & 29 deletions integrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,35 +455,6 @@
}
]
},
{
"name": "HttpContext",
"method_replacements": [
{
"caller": {},
"target": {
"assembly": "Microsoft.AspNetCore.Http.Abstractions",
"type": "Microsoft.AspNetCore.Http.DefaultHttpContext",
"method": "Initialize",
"signature_types": [
"System.Void",
"_"
],
"minimum_major": 0,
"minimum_minor": 0,
"minimum_patch": 0,
"maximum_major": 65535,
"maximum_minor": 65535,
"maximum_patch": 65535
},
"wrapper": {
"assembly": "Datadog.Trace.ClrProfiler.Managed, Version=1.5.1.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb",
"type": "Datadog.Trace.ClrProfiler.Integrations.HttpContextIntegration",
"method": "Initialize",
"signature": "00 04 01 1C 1C 08 08"
}
}
]
},
{
"name": "HttpMessageHandler",
"method_replacements": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net461;netcoreapp2.1</TargetFrameworks>
<Platforms>x64;x86</Platforms>
<PlatformTarget>$(Platform)</PlatformTarget>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions reproductions/AspNetMvcCorePerformance/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>

<PropertyGroup>
<Platforms>x64;x86</Platforms>
<PlatformTarget>$(Platform)</PlatformTarget>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>

</Project>
102 changes: 102 additions & 0 deletions reproductions/AspNetMvcCorePerformance/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
#if !NETCOREAPP
using System.Net;
#endif
using System.Threading;

namespace AspNetMvcCorePerformance
{
public class Program
{
public static int Main(string[] args)
{
try
{
string urlBase = "http://localhost:54562/";
var threadCount = 1;
var iterationsPerThread = 50;

if (args?.Length > 0)
{
urlBase = args[0];
threadCount = int.Parse(args[1]);
iterationsPerThread = int.Parse(args[2]);
}

var threadRepresentation = Enumerable.Range(0, threadCount).ToArray();

var exceptionBag = new ConcurrentBag<Exception>();

Console.WriteLine($"Running {threadRepresentation.Length} threads with {iterationsPerThread} iterations.");

var resources = new List<string>
{
"delay/0", // 1
"delay-async/0",
"delay-async/0",
"home/index",
"home/index",
"home/index",
"status-code/200",
"delay/0",
"delay/0",
"home/index" // 10
};

var threadNumber = 0;

var threads =
threadRepresentation
.Select(
idx => new Thread(
thread =>
{
try
{
var myThread = threadNumber++;
var myResource = resources[myThread];

Thread.Sleep(2000);
var i = 0;
while (i++ < iterationsPerThread)
{
Console.WriteLine($"(Thread: {myThread}, #: {i}) Calling: {myResource}");
var client = new HttpClient();
var uri = $"{urlBase}{myResource}";
var responseTask = client.GetAsync(uri);
responseTask.Wait();
var result = responseTask.Result;
}
}
catch (Exception ex)
{
exceptionBag.Add(ex);
}
}))
.ToList();

foreach (var thread in threads)
{
thread.Start();
}

while (threads.Any(x => x.IsAlive))
{
Thread.Sleep(1000);
}
}
catch (Exception ex)
{
Console.WriteLine($"We have encountered an exception, the smoke test fails: {ex.Message}");
Console.Error.WriteLine(ex);
return -10;
}

return 0;
}
}
}
Loading

0 comments on commit 5fef5d3

Please sign in to comment.