Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request #5 from alhardy/dev
Browse files Browse the repository at this point in the history
1.1.0 Release
  • Loading branch information
alhardy authored Apr 22, 2017
2 parents 9bc305b + 6fe7015 commit 74ca981
Show file tree
Hide file tree
Showing 51 changed files with 763 additions and 1,468 deletions.
9 changes: 9 additions & 0 deletions AppMetrics.Extensions.InfluxDB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "grafana-dashboards", "grafa
visualization\grafana-dashbaords\App.Metrics.Sandbox-InfluxDB-GenericWebOAuth2.json = visualization\grafana-dashbaords\App.Metrics.Sandbox-InfluxDB-GenericWebOAuth2.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sandbox", "sandbox", "{B0E330F2-942D-47DC-940D-692E01459A06}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Metrics.InfluxDB.Sandbox", "sandbox\App.Metrics.InfluxDB.Sandbox\App.Metrics.InfluxDB.Sandbox.csproj", "{4D15C49F-F4DC-4631-B8FA-1D307C461227}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -58,6 +62,10 @@ Global
{84005F55-AF0E-40F4-A596-129E19C418CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84005F55-AF0E-40F4-A596-129E19C418CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84005F55-AF0E-40F4-A596-129E19C418CE}.Release|Any CPU.Build.0 = Release|Any CPU
{4D15C49F-F4DC-4631-B8FA-1D307C461227}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D15C49F-F4DC-4631-B8FA-1D307C461227}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D15C49F-F4DC-4631-B8FA-1D307C461227}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D15C49F-F4DC-4631-B8FA-1D307C461227}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -69,5 +77,6 @@ Global
{84005F55-AF0E-40F4-A596-129E19C418CE} = {DD2E4647-7125-4CE3-9BA5-B45A26113A31}
{5BC3B2AF-AFC7-4C92-BD1E-D347E83B2497} = {31A4DDB1-952E-4EED-96EF-29C669279A86}
{44E50731-4AE5-456F-A84C-CE3C4C977097} = {5BC3B2AF-AFC7-4C92-BD1E-D347E83B2497}
{4D15C49F-F4DC-4631-B8FA-1D307C461227} = {B0E330F2-942D-47DC-940D-692E01459A06}
EndGlobalSection
EndGlobal
8 changes: 7 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ image: Visual Studio 2017
environment:
COVERALLS_REPO_TOKEN:
secure: jE+uYnSDVrBExOFkaPPHpJeKfHxVuS+lYvS+8BlcKBTSioz25h+rBq3RxMGl9JBd
PreReleaseSuffix: alpha
PreReleaseSuffix: stable
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
GitUser:
secure: zAdAOUUof3XGDsdOBRYg7J7wZS44iL4VjI/MVGw+JnU=
GitOwner:
secure: n6W5JZ7Q/xfZC7b2k3+ORA==
GitPassword:
secure: G1CZ0EzJTYjH60jzYYaitkieeslue7VdeeVW4vYS+msXQ9gSCf7KstBKEbXdI+W2
build_script:
- ps: .\build.ps1 -Target AppVeyor
test: off
Expand Down
70 changes: 49 additions & 21 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#tool "nuget:?package=ReSharperReports"
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
#tool "nuget:?package=coveralls.io"
#tool "nuget:?package=gitreleasemanager"

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand All @@ -19,12 +20,14 @@ var coverWith = HasArgument("CoverWith") ? Argument<string>("CoverWith") :
EnvironmentVariable("CoverWith") != null ? EnvironmentVariable("CoverWith") : "OpenCover"; // None, DotCover, OpenCover
var skipReSharperCodeInspect = Argument("SkipCodeInspect", false) || !IsRunningOnWindows();
var preReleaseSuffix = HasArgument("PreReleaseSuffix") ? Argument<string>("PreReleaseSuffix") :
(AppVeyor.IsRunningOnAppVeyor && AppVeyor.Environment.Repository.Tag.IsTag) ? null :
(AppVeyor.IsRunningOnAppVeyor && EnvironmentVariable("PreReleaseSuffix") == null) ? null :
EnvironmentVariable("PreReleaseSuffix") != null ? EnvironmentVariable("PreReleaseSuffix") : "ci";
var buildNumber = HasArgument("BuildNumber") ? Argument<int>("BuildNumber") :
AppVeyor.IsRunningOnAppVeyor ? AppVeyor.Environment.Build.Number :
TravisCI.IsRunningOnTravisCI ? TravisCI.Environment.Build.BuildNumber :
EnvironmentVariable("BuildNumber") != null ? int.Parse(EnvironmentVariable("BuildNumber")) : 0;
var gitUser = HasArgument("GitUser") ? Argument<string>("GitUser") : EnvironmentVariable("GitUser");
var gitPassword = HasArgument("GitPassword") ? Argument<string>("GitPassword") : EnvironmentVariable("GitPassword");

//////////////////////////////////////////////////////////////////////
// DEFINE FILES & DIRECTORIES
Expand Down Expand Up @@ -72,6 +75,30 @@ Task("Clean")
CleanDirectory(testResultsDir);
});

Task("ReleaseNotes")
.IsDependentOn("Clean")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor && AppVeyor.Environment.Repository.Tag.IsTag && AppVeyor.Environment.Repository.Branch == "master")
.Does(() =>
{
var preRelease = preReleaseSuffix != null;
var milestone = AppVeyor.Environment.Repository.Tag.Name;
var owner = AppVeyor.Environment.Repository.Name.Split('/')[0];
var repo = AppVeyor.Environment.Repository.Name.Split('/')[1];
var tag = AppVeyor.Environment.Repository.Tag.Name;

Context.Information("Creating release notes for Milestone " + milestone);
GitReleaseManagerCreate(gitUser, gitPassword, owner, repo, new GitReleaseManagerCreateSettings {
Milestone = milestone,
Prerelease = preRelease
});

Context.Information("Publishing Release Notes for Tag " + tag);
GitReleaseManagerPublish(gitUser, gitPassword, owner, repo, tag);

Context.Information("Closing Milestone " + milestone);
GitReleaseManagerClose(gitUser, gitPassword, owner, repo, milestone);
});

Task("Restore")
.IsDependentOn("Clean")
.Does(() =>
Expand All @@ -81,25 +108,24 @@ Task("Restore")
Sources = new [] { "https://api.nuget.org/v3/index.json", "https://www.myget.org/F/alhardy/api/v3/index.json" }
};

var projects = solution.GetProjects();

foreach(var project in projects)
{
DotNetCoreRestore(project.Path.ToString(), settings);
}
DotNetCoreRestore(solutionFile, settings);
});

Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
var projects = solution.GetProjects();

var settings = new DotNetCoreBuildSettings { Configuration = configuration };

foreach(var project in projects)
{
if (!IsRunningOnWindows())
if (IsRunningOnWindows())
{
DotNetCoreBuild(solutionFile, settings);
}
else
{
var projects = solution.GetProjects();

foreach(var project in projects)
{
// Ignore Net452 on non-windows environments
if (project.Path.ToString().Contains("Net452"))
Expand All @@ -109,7 +135,7 @@ Task("Build")

var parsedProject = ParseProject(new FilePath(project.Path.ToString()), configuration);

if (parsedProject.IsLibrary() && !project.Path.ToString().Contains(".Facts") && !project.Path.ToString().Contains(".Benchmarks"))
if (parsedProject.IsLibrary() && !project.Path.ToString().Contains(".Sandbox")&& !project.Path.ToString().Contains(".Facts") && !project.Path.ToString().Contains(".Benchmarks"))
{
settings.Framework = "netstandard1.6";
}
Expand All @@ -119,10 +145,11 @@ Task("Build")
}

Context.Information("Building as " + settings.Framework + ": " + project.Path.ToString());
}

DotNetCoreBuild(project.Path.ToString(), settings);
}
DotNetCoreBuild(project.Path.ToString(), settings);
}

}
});

Task("Pack")
Expand Down Expand Up @@ -367,19 +394,20 @@ Task("PublishCoverage")
//////////////////////////////////////////////////////////////////////

Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Build")
.IsDependentOn("PublishTestResults")
.IsDependentOn("Pack")
.IsDependentOn("Pack")
.IsDependentOn("HtmlCoverageReport")
.IsDependentOn("RunInspectCode");

Task("AppVeyor")
.IsDependentOn("Build")
.IsDependentOn("Build")
.IsDependentOn("PublishTestResults")
.IsDependentOn("Pack")
.IsDependentOn("Pack")
.IsDependentOn("HtmlCoverageReport")
.IsDependentOn("RunInspectCode")
.IsDependentOn("PublishCoverage");
.IsDependentOn("PublishCoverage")
.IsDependentOn("ReleaseNotes");

//////////////////////////////////////////////////////////////////////
// EXECUTION
Expand Down
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>
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 sandbox/App.Metrics.InfluxDB.Sandbox/Controllers/FileController.cs
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();
}
}
}
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;
}
}
}
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);
}
}
}
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;
}
}
}
Loading

0 comments on commit 74ca981

Please sign in to comment.