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.
Manually revert http context integration (DataDog#455)
* 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
1 parent
dfdbfac
commit 5fef5d3
Showing
13 changed files
with
666 additions
and
126 deletions.
There are no files selected for viewing
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
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
16 changes: 16 additions & 0 deletions
16
reproductions/AspNetMvcCorePerformance/AspNetMvcCorePerformance.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 |
---|---|---|
@@ -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
10
reproductions/AspNetMvcCorePerformance/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,10 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<Platforms>x64;x86</Platforms> | ||
<PlatformTarget>$(Platform)</PlatformTarget> | ||
<IsPackable>false</IsPackable> | ||
<GenerateDocumentationFile>false</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
|
||
</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,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; | ||
} | ||
} | ||
} |
Oops, something went wrong.