diff --git a/Directory.Packages.props b/Directory.Packages.props index 8164fd5..593e495 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,6 +5,7 @@ + diff --git a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs index f987e35..cf4c6ea 100644 --- a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs +++ b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs @@ -1,4 +1,5 @@ -using KurrentDB.Client; +using HealthMonitoring.Client; +using KurrentDB.Client; using Microsoft.OpenApi; using Shared.Monitoring; @@ -120,7 +121,7 @@ public MiddlewareRegistry() options.MemoryBufferThreshold = int.MaxValue; // buffer threshold }); - this.AddUptimeKuma(); + this.AddHealthMonitoringRegistration(Startup.Configuration); } #endregion diff --git a/FileProcessor/FileProcessor.csproj b/FileProcessor/FileProcessor.csproj index 2c6d60f..2c46205 100644 --- a/FileProcessor/FileProcessor.csproj +++ b/FileProcessor/FileProcessor.csproj @@ -6,6 +6,7 @@ + diff --git a/FileProcessor/Program.cs b/FileProcessor/Program.cs index 607d1dd..ef4dca3 100644 --- a/FileProcessor/Program.cs +++ b/FileProcessor/Program.cs @@ -88,7 +88,11 @@ public static IHostBuilder CreateHostBuilder(string[] args) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true) .AddJsonFile($"/home/txnproc/config/appsettings.local.json", optional: true, reloadOnChange: true) - .AddEnvironmentVariables(); + .AddEnvironmentVariables() + .AddInMemoryCollection(new Dictionary + { + ["HealthMonitoring:Service:Version"] = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0" + }); // Build a snapshot of configuration so we can use it immediately (e.g. for Sentry) var builtConfig = configBuilder.Build(); diff --git a/FileProcessor/Startup.cs b/FileProcessor/Startup.cs index 8ebab2e..130480a 100644 --- a/FileProcessor/Startup.cs +++ b/FileProcessor/Startup.cs @@ -146,14 +146,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF app.UseSwagger(); app.UseSwaggerUI(); - - lifetime.ApplicationStarted.Register(() => - { - host.RegisterWithUptimeKumaAsync() - .GetAwaiter() - .GetResult(); - }); - app.PreWarm(); } } diff --git a/FileProcessor/appsettings.json b/FileProcessor/appsettings.json index 59b6773..6af69b8 100644 --- a/FileProcessor/appsettings.json +++ b/FileProcessor/appsettings.json @@ -30,11 +30,27 @@ }, "TemporaryFileLocation": "/home/txnproc/bulkfiles/temporary" }, - "UptimeKuma": { - "Monitor": { + "HealthMonitoring": { + "Service": { + "ServiceId": "file-processor", "Name": "File Processor", - "Url": "http://localhost:5009/health", - "IntervalInSeconds": 60 - } + "Description": "File Processor", + "HealthUrl": "http://localhost:5009/healthui", + "IgnoreCertificateErrors": true + }, + "Dependencies": [ + { + "DependencyName": "Security Service", + "TargetServiceId": "security-service" + }, + { + "DependencyName": "Transaction Processor Service", + "TargetServiceId": "transaction-processor" + }, + { + "DependencyName": "Eventstore", + "TargetServiceId": "kurrentdb" + } + ] } }