Merge pull request #974 from mvelosop/fix/health-check-report-collector-exception
Fix/health check report collector exception
This commit is contained in:
commit
b439352cae
@ -324,7 +324,7 @@ services:
|
|||||||
|
|
||||||
webstatus:
|
webstatus:
|
||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- HealthChecks-UI__HealthChecks__1__Name=WebMVC HTTP Check
|
- HealthChecks-UI__HealthChecks__1__Name=WebMVC HTTP Check
|
||||||
- HealthChecks-UI__HealthChecks__1__Uri=http://webmvc/hc
|
- HealthChecks-UI__HealthChecks__1__Uri=http://webmvc/hc
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace WebStatus
|
namespace WebStatus
|
||||||
{
|
{
|
||||||
@ -24,6 +26,8 @@ namespace WebStatus
|
|||||||
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
|
Log.Information("Configuring web host ({ApplicationContext})...", AppName);
|
||||||
var host = BuildWebHost(configuration, args);
|
var host = BuildWebHost(configuration, args);
|
||||||
|
|
||||||
|
LogPackagesVersionInfo();
|
||||||
|
|
||||||
Log.Information("Starting web host ({ApplicationContext})...", AppName);
|
Log.Information("Starting web host ({ApplicationContext})...", AppName);
|
||||||
host.Run();
|
host.Run();
|
||||||
|
|
||||||
@ -83,5 +87,39 @@ namespace WebStatus
|
|||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetVersion(Assembly assembly)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return $"{assembly.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version} ({assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split()[0]})";
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LogPackagesVersionInfo()
|
||||||
|
{
|
||||||
|
var assemblies = new List<Assembly>();
|
||||||
|
|
||||||
|
foreach (var dependencyName in typeof(Program).Assembly.GetReferencedAssemblies())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Try to load the referenced assembly...
|
||||||
|
assemblies.Add(Assembly.Load(dependencyName));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Failed to load assembly. Skip it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var versionList = assemblies.Select(a => $"-{a.GetName().Name} - {GetVersion(a)}").OrderBy(value => value);
|
||||||
|
|
||||||
|
Log.Logger.ForContext("PackageVersions", string.Join("\n", versionList)).Information("Package versions ({ApplicationContext})", AppName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,9 +11,9 @@
|
|||||||
<None Remove="Views\**" />
|
<None Remove="Views\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="2.2.8" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="2.2.22" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.2" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="2.2.3" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.0" />
|
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="2.2.2" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
|
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.6.1" />
|
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.6.1" />
|
||||||
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.2" />
|
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.2" />
|
||||||
@ -24,10 +24,18 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="1.0.172" />
|
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="1.0.172" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
||||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.2" />
|
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
|
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="appsettings.Development.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,10 +1,87 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"HealthChecks-UI": {
|
||||||
"IncludeScopes": false,
|
"HealthChecks": [
|
||||||
"LogLevel": {
|
{
|
||||||
"Default": "Debug",
|
"Name": "Ordering HTTP Check",
|
||||||
"System": "Information",
|
"Uri": "http://localhost:5102/hc"
|
||||||
"Microsoft": "Information"
|
},
|
||||||
|
{
|
||||||
|
"Name": "Ordering HTTP Background Check",
|
||||||
|
"Uri": "http://localhost:5111/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Basket HTTP Check",
|
||||||
|
"Uri": "http://localhost:5103/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Catalog HTTP Check",
|
||||||
|
"Uri": "http://localhost:5101/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Identity HTTP Check",
|
||||||
|
"Uri": "http://localhost:5105/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Marketing HTTP Check",
|
||||||
|
"Uri": "http://localhost:5110/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Locations HTTP Check",
|
||||||
|
"Uri": "http://localhost:5109/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Payments HTTP Check",
|
||||||
|
"Uri": "http://localhost:5108/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "WebMVC HTTP Check",
|
||||||
|
"Uri": "http://localhost:5100/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "WebSPA HTTP Check",
|
||||||
|
"Uri": "http://localhost:5104/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "SignalR HTTP Check",
|
||||||
|
"Uri": "http://localhost:5112/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Mobile Shopping API GW HTTP Check",
|
||||||
|
"Uri": "http://localhost:5200/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Mobile Marketing API GW HTTP Check",
|
||||||
|
"Uri": "http://localhost:5201/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Web Shopping API GW HTTP Check",
|
||||||
|
"Uri": "http://localhost:5202/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Web Marketing API GW HTTP Check",
|
||||||
|
"Uri": "http://localhost:5203/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Mobile Shopping Aggregator HTTP Check",
|
||||||
|
"Uri": "http://localhost:5120/hc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Web Shopping Aggregator HTTP Check",
|
||||||
|
"Uri": "http://localhost:5121/hc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"EvaluationTimeOnSeconds": 10,
|
||||||
|
"MinimumSecondsBetweenFailureNotifications": 60
|
||||||
|
},
|
||||||
|
"Serilog": {
|
||||||
|
"SeqServerUrl": "http://localhost:5341/",
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Override": {
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.eShopOnContainers": "Information",
|
||||||
|
"System": "Warning"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,83 +1,5 @@
|
|||||||
{
|
{
|
||||||
"HealthChecks-UI": {
|
"HealthChecks-UI": {
|
||||||
"HealthChecks": [
|
|
||||||
{
|
|
||||||
"Name": "Ordering HTTP Check",
|
|
||||||
"Uri": "http://localhost:5102/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Ordering HTTP Background Check",
|
|
||||||
"Uri": "http://localhost:5111/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Basket HTTP Check",
|
|
||||||
"Uri": "http://localhost:5103/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Catalog HTTP Check",
|
|
||||||
"Uri": "http://localhost:5101/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Identity HTTP Check",
|
|
||||||
"Uri": "http://localhost:5105/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Marketing HTTP Check",
|
|
||||||
"Uri": "http://localhost:5110/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Locations HTTP Check",
|
|
||||||
"Uri": "http://localhost:5109/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Payments HTTP Check",
|
|
||||||
"Uri": "http://localhost:5108/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "WebMVC HTTP Check",
|
|
||||||
"Uri": "http://localhost:5100/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "WebSPA HTTP Check",
|
|
||||||
"Uri": "http://localhost:5104/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "SignalR HTTP Check",
|
|
||||||
"Uri": "http://localhost:5112/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Mobile Shopping API GW HTTP Check",
|
|
||||||
"Uri": "http://localhost:5200/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Mobile Marketing API GW HTTP Check",
|
|
||||||
"Uri": "http://localhost:5201/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Web Shopping API GW HTTP Check",
|
|
||||||
"Uri": "http://localhost:5202/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Web Marketing API GW HTTP Check",
|
|
||||||
"Uri": "http://localhost:5203/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Mobile Shopping Aggregator HTTP Check",
|
|
||||||
"Uri": "http://localhost:5120/hc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Web Shopping Aggregator HTTP Check",
|
|
||||||
"Uri": "http://localhost:5121/hc"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Webhooks": [
|
|
||||||
{
|
|
||||||
"Name": "",
|
|
||||||
"Uri": "",
|
|
||||||
"Payload": "",
|
|
||||||
"RestoredPayload": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"EvaluationTimeOnSeconds": 10,
|
"EvaluationTimeOnSeconds": 10,
|
||||||
"MinimumSecondsBetweenFailureNotifications": 60
|
"MinimumSecondsBetweenFailureNotifications": 60
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user