This repository has been archived by the owner on Mar 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from alhardy/dev
1.1.0 Release
- Loading branch information
Showing
51 changed files
with
763 additions
and
1,468 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
34 changes: 34 additions & 0 deletions
34
sandbox/App.Metrics.InfluxDB.Sandbox/App.Metrics.InfluxDB.Sandbox.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,34 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp1.1</TargetFramework> | ||
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="App.Metrics" Version="1.1.0" /> | ||
<PackageReference Include="App.Metrics.Concurrency" Version="1.1.0" /> | ||
<PackageReference Include="App.Metrics.Extensions.Middleware" Version="1.1.0" /> | ||
<PackageReference Include="App.Metrics.Extensions.Mvc" Version="1.1.0" /> | ||
<PackageReference Include="App.Metrics.Formatters.Json" Version="1.1.0" /> | ||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\App.Metrics.Extensions.Reporting.InfluxDB\App.Metrics.Extensions.Reporting.InfluxDB.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Update="appsettings.json"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
</Project> |
28 changes: 28 additions & 0 deletions
28
sandbox/App.Metrics.InfluxDB.Sandbox/Controllers/ExceptionThrowingController.cs
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,28 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace App.Metrics.InfluxDB.Sandbox.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
public class ExceptionThrowingController : Controller | ||
{ | ||
private readonly IMetrics _metrics; | ||
|
||
public ExceptionThrowingController(IMetrics metrics) | ||
{ | ||
_metrics = metrics ?? throw new ArgumentNullException(nameof(metrics)); | ||
} | ||
|
||
[HttpGet] | ||
public async Task<int> Get() | ||
{ | ||
await Task.Run(() => | ||
{ | ||
throw new Exception(); | ||
}); | ||
|
||
return 0; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
sandbox/App.Metrics.InfluxDB.Sandbox/Controllers/FileController.cs
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,22 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace App.Metrics.InfluxDB.Sandbox.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
public class FileController : Controller | ||
{ | ||
[HttpPost] | ||
public IActionResult Post(IFormFile file) | ||
{ | ||
return Created(new Uri("http://localhost"), 0); | ||
} | ||
|
||
[HttpPut] | ||
public IActionResult Put(IFormFile file) | ||
{ | ||
return Ok(); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
sandbox/App.Metrics.InfluxDB.Sandbox/Controllers/FrustratingController.cs
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,31 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using App.Metrics.InfluxDB.Sandbox.JustForTesting; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace App.Metrics.InfluxDB.Sandbox.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
public class FrustratingController : Controller | ||
{ | ||
private readonly RequestDurationForApdexTesting _durationForApdexTesting; | ||
|
||
private readonly IMetrics _metrics; | ||
|
||
public FrustratingController(IMetrics metrics, RequestDurationForApdexTesting durationForApdexTesting) | ||
{ | ||
_metrics = metrics ?? throw new ArgumentNullException(nameof(metrics)); | ||
_durationForApdexTesting = durationForApdexTesting; | ||
} | ||
|
||
[HttpGet] | ||
public async Task<int> Get() | ||
{ | ||
var duration = _durationForApdexTesting.NextFrustratingDuration; | ||
|
||
await Task.Delay(duration, HttpContext.RequestAborted); | ||
|
||
return duration; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
sandbox/App.Metrics.InfluxDB.Sandbox/Controllers/RandomStatusCodeController.cs
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,25 @@ | ||
using System; | ||
using App.Metrics.InfluxDB.Sandbox.JustForTesting; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace App.Metrics.InfluxDB.Sandbox.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
public class RandomStatusCodeController : Controller | ||
{ | ||
private readonly RandomStatusCodeForTesting _randomStatusCodeForTesting; | ||
private readonly IMetrics _metrics; | ||
|
||
public RandomStatusCodeController(IMetrics metrics, RandomStatusCodeForTesting randomStatusCodeForTesting) | ||
{ | ||
_metrics = metrics ?? throw new ArgumentNullException(nameof(metrics)); | ||
_randomStatusCodeForTesting = randomStatusCodeForTesting; | ||
} | ||
|
||
[HttpGet] | ||
public IActionResult Get() | ||
{ | ||
return StatusCode(_randomStatusCodeForTesting.NextStatusCode); | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
sandbox/App.Metrics.InfluxDB.Sandbox/Controllers/SatisfyingController.cs
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,65 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using App.Metrics.Core.Options; | ||
using App.Metrics.InfluxDB.Sandbox.JustForTesting; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace App.Metrics.InfluxDB.Sandbox.Controllers | ||
{ | ||
public static class Registry | ||
{ | ||
public static HistogramOptions One = new HistogramOptions | ||
{ | ||
Name = "test1", | ||
MeasurementUnit = Unit.Bytes, | ||
Context = "test" | ||
}; | ||
|
||
public static HistogramOptions Two = new HistogramOptions | ||
{ | ||
Name = "test2", | ||
MeasurementUnit = Unit.Bytes, | ||
Context = "test" | ||
}; | ||
|
||
public static HistogramOptions Three = new HistogramOptions | ||
{ | ||
Name = "test3", | ||
MeasurementUnit = Unit.Bytes, | ||
Context = "test" | ||
}; | ||
} | ||
|
||
[Route("api/[controller]")] | ||
public class SatisfyingController : Controller | ||
{ | ||
private readonly RequestDurationForApdexTesting _durationForApdexTesting; | ||
private static readonly Random Rnd = new Random(); | ||
private readonly IMetrics _metrics; | ||
|
||
public SatisfyingController(IMetrics metrics, RequestDurationForApdexTesting durationForApdexTesting) | ||
{ | ||
_metrics = metrics ?? throw new ArgumentNullException(nameof(metrics)); | ||
_durationForApdexTesting = durationForApdexTesting; | ||
} | ||
|
||
[HttpGet] | ||
public async Task<int> Get() | ||
{ | ||
var duration = _durationForApdexTesting.NextSatisfiedDuration; | ||
|
||
//foreach (var i in Enumerable.Range(1, 500)) | ||
//{ | ||
// var tags = new MetricTags($"key{i}", $"value{i}"); | ||
|
||
// _metrics.Measure.Histogram.Update(Registry.One, tags, Rnd.Next(1, 500)); | ||
// _metrics.Measure.Histogram.Update(Registry.Two, tags, Rnd.Next(1, 500)); | ||
// _metrics.Measure.Histogram.Update(Registry.Three, tags, Rnd.Next(1, 500)); | ||
//} | ||
|
||
await Task.Delay(duration, HttpContext.RequestAborted); | ||
|
||
return duration; | ||
} | ||
} | ||
} |
Oops, something went wrong.