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 #15 from AppMetrics/dev
Browse files Browse the repository at this point in the history
2.0.0
  • Loading branch information
alhardy authored Mar 29, 2018
2 parents a460129 + 9bdf97e commit bb85a2f
Show file tree
Hide file tree
Showing 14 changed files with 399 additions and 31 deletions.
12 changes: 11 additions & 1 deletion Health.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26906.1
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2D805782-756E-4C98-B22E-F502BEE95318}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{31A4DDB1-952E-4EED-96EF-29C669279A86}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -79,6 +82,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Metrics.Health.Checks.P
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Metrics.Health.Abstractions", "src\App.Metrics.Health.Abstractions\App.Metrics.Health.Abstractions.csproj", "{6F6F9F53-4A1B-4F2B-96E3-A75BA47BCA1D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Metrics.Health.Checks.Sql", "src\App.Metrics.Health.Checks.Sql\App.Metrics.Health.Checks.Sql.csproj", "{ABF2C6E2-815B-495E-9E50-12FEFEA3E383}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -145,6 +150,10 @@ Global
{6F6F9F53-4A1B-4F2B-96E3-A75BA47BCA1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F6F9F53-4A1B-4F2B-96E3-A75BA47BCA1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F6F9F53-4A1B-4F2B-96E3-A75BA47BCA1D}.Release|Any CPU.Build.0 = Release|Any CPU
{ABF2C6E2-815B-495E-9E50-12FEFEA3E383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABF2C6E2-815B-495E-9E50-12FEFEA3E383}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABF2C6E2-815B-495E-9E50-12FEFEA3E383}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABF2C6E2-815B-495E-9E50-12FEFEA3E383}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -169,6 +178,7 @@ Global
{2B7465B0-B2AA-42BB-B4D2-7D70CC7ED9CB} = {2D805782-756E-4C98-B22E-F502BEE95318}
{ED057808-8377-46BB-95EA-2F03865B0116} = {DD2E4647-7125-4CE3-9BA5-B45A26113A31}
{6F6F9F53-4A1B-4F2B-96E3-A75BA47BCA1D} = {2D805782-756E-4C98-B22E-F502BEE95318}
{ABF2C6E2-815B-495E-9E50-12FEFEA3E383} = {2D805782-756E-4C98-B22E-F502BEE95318}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A8699A1D-0BA1-403C-86E9-C789CD2645EB}
Expand Down
9 changes: 9 additions & 0 deletions Health.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_METHOD_ON_SINGLE_LINE/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_TYPE_CONSTRAINTS_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_WHILE_ON_NEW_LINE/@EntryValue">True</s:Boolean>
Expand Down Expand Up @@ -531,9 +535,14 @@
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=NAMESPACE_005FALIAS/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpFileLayoutPatternsUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data&gt;&lt;AttributeFilter ClassMask="App.Metrics.Core.Internal.AppMetricsExcludeFromCodeCoverage" IsEnabled="True" /&gt;&lt;AttributeFilter ClassMask="App.Metrics.Core.Internal.AppMetricsExcludeFromCodeCoverageAttribute" IsEnabled="True" /&gt;&lt;/data&gt;</s:String>
Expand Down
1 change: 1 addition & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var packDirs = new [] {
Directory("./src/App.Metrics.Health.Checks.Http"),
Directory("./src/App.Metrics.Health.Checks.Network"),
Directory("./src/App.Metrics.Health.Checks.Process"),
Directory("./src/App.Metrics.Health.Checks.Sql"),
Directory("./src/App.Metrics.Health.Core"),
Directory("./src/App.Metrics.Health.Formatters.Ascii"),
Directory("./src/App.Metrics.Health.Formatters.Json")
Expand Down
23 changes: 12 additions & 11 deletions build/dependencies.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<Project>
<PropertyGroup>
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
<BenchmarkDotNetVersion>0.10.8</BenchmarkDotNetVersion>
<CoreFxVersion>4.4.0-*</CoreFxVersion>
<DependencyModelVersion>2.0.0-*</DependencyModelVersion>
<AspNetCoreVersion>2.0.1</AspNetCoreVersion>
<MicrosoftExtensionsVersion>2.0.0</MicrosoftExtensionsVersion>
<BenchmarkDotNetVersion>0.10.12</BenchmarkDotNetVersion>
<CoreFxVersion>4.4.0</CoreFxVersion>
<DependencyModelVersion>2.0.4</DependencyModelVersion>
<LibLogVersion>4.2.6</LibLogVersion>
<MicrosoftCSharpVersion>4.4.0</MicrosoftCSharpVersion>
<MoqVersion>4.7.49</MoqVersion>
<NewtonsoftVersion>10.0.2</NewtonsoftVersion>
<MicrosoftCSharpVersion>4.4.1</MicrosoftCSharpVersion>
<MoqVersion>4.8.1</MoqVersion>
<NewtonsoftVersion>10.0.3</NewtonsoftVersion>
<NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion>
<RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netcoreapp2.0'">2.0.0-*</RuntimeFrameworkVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion>
<XunitVersion>2.3.0-beta2-*</XunitVersion>
<FluentAssertionsVersion>4.19.2</FluentAssertionsVersion>
<FluentAssertionsJsonVersion>4.19.0</FluentAssertionsJsonVersion>
<TestSdkVersion>15.5.0</TestSdkVersion>
<XunitVersion>2.3.1</XunitVersion>
<FluentAssertionsVersion>5.0.0</FluentAssertionsVersion>
<FluentAssertionsJsonVersion>5.0.0</FluentAssertionsJsonVersion>
<StyleCopAnalyzersVersion>1.0.0</StyleCopAnalyzersVersion>
</PropertyGroup>
</Project>
7 changes: 5 additions & 2 deletions sandbox/HealthSandbox/HealthSandbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
<ProjectReference Include="..\..\src\App.Metrics.Health.Checks.Http\App.Metrics.Health.Checks.Http.csproj" />
<ProjectReference Include="..\..\src\App.Metrics.Health.Checks.Network\App.Metrics.Health.Checks.Network.csproj" />
<ProjectReference Include="..\..\src\App.Metrics.Health.Checks.Process\App.Metrics.Health.Checks.Process.csproj" />
<ProjectReference Include="..\..\src\App.Metrics.Health.Checks.Sql\App.Metrics.Health.Checks.Sql.csproj" />
<ProjectReference Include="..\..\src\App.Metrics.Health\App.Metrics.Health.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsVersion)" />
<PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="3.3.3" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.9" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 9 additions & 2 deletions sandbox/HealthSandbox/Host.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
using System.Threading;
using System.Threading.Tasks;
using App.Metrics.Health;
using App.Metrics.Health.Checks.Sql;
using HealthSandbox.HealthChecks;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Configuration;
using Serilog;
using static System.Console;
Expand All @@ -17,6 +19,8 @@ namespace HealthSandbox
{
public static class Host
{
private static readonly string ConnectionString = "Data Source=DBHealthCheck;Mode=Memory;Cache=Shared";

public static IConfigurationRoot Configuration { get; set; }

public static IHealthRoot Health { get; set; }
Expand All @@ -28,7 +32,7 @@ public static async Task Main()
var cancellationTokenSource = new CancellationTokenSource();

await RunUntilEscAsync(
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(20),
cancellationTokenSource,
async () =>
{
Expand Down Expand Up @@ -73,7 +77,9 @@ private static void Init()
.HealthChecks.AddProcessVirtualMemorySizeCheck("Virtual Memory Size", 200)
.HealthChecks.AddProcessPhysicalMemoryCheck("Working Set", 200)
.HealthChecks.AddPingCheck("google ping", "google.com", TimeSpan.FromSeconds(10))
.HealthChecks.AddHttpGetCheck("github", new Uri("https://github.com/"), TimeSpan.FromSeconds(10))
.HealthChecks.AddHttpGetCheck("invalid http", new Uri("https://invalid-asdfadsf.com/"), 3, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1))
.HealthChecks.AddHttpGetCheck("github", new Uri("https://github.com/"), retries: 3, delayBetweenRetries: TimeSpan.FromMilliseconds(100), timeoutPerRequest: TimeSpan.FromSeconds(5))
.HealthChecks.AddHttpGetCheck("google", new Uri("https://google.com/"), TimeSpan.FromSeconds(1))
.HealthChecks.AddCheck("DatabaseConnected", () => new ValueTask<HealthCheckResult>(HealthCheckResult.Healthy("Database Connection OK")))
.HealthChecks.AddCheck(
"DiskSpace",
Expand All @@ -85,6 +91,7 @@ private static void Init()
? HealthCheckResult.Unhealthy("Not enough disk space: {0}", freeDiskSpace)
: HealthCheckResult.Unhealthy("Disk space ok: {0}", freeDiskSpace));
})
.HealthChecks.AddSqlCheck("DB Connection", () => new SqliteConnection(ConnectionString), TimeSpan.FromSeconds(10))
.Build();

int GetFreeDiskSpace()
Expand Down
Loading

0 comments on commit bb85a2f

Please sign in to comment.