From e4d713833fde56ec830903cf014d59e3ebb7d308 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Mon, 21 Sep 2026 19:04:53 +0100 Subject: [PATCH 1/3] add health monitoring --- CallbackHandler/Bootstrapper/MiddlewareRegistry.cs | 5 +++-- CallbackHandler/CallbackHandler.csproj | 1 + CallbackHandler/Program.cs | 6 +++++- CallbackHandler/appsettings.json | 14 ++++++++++++++ Directory.Packages.props | 1 + 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs b/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs index 29c2e75..d74feb9 100644 --- a/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs +++ b/CallbackHandler/Bootstrapper/MiddlewareRegistry.cs @@ -1,4 +1,5 @@ -using KurrentDB.Client; +using HealthMonitoring.Client; +using KurrentDB.Client; using Microsoft.Extensions.Logging; using Microsoft.OpenApi; using Shared.Monitoring; @@ -47,7 +48,7 @@ public MiddlewareRegistry() this.ConfigureHttpJsonOptions(jsonOptions => JsonSerializerConfiguration.ConfigureMinimalApi(jsonOptions.SerializerOptions)); - this.AddUptimeKuma(); + this.AddHealthMonitoringRegistration(Startup.Configuration); } private void AddSwaggerAction(SwaggerGenOptions c) { diff --git a/CallbackHandler/CallbackHandler.csproj b/CallbackHandler/CallbackHandler.csproj index bddb7ff..31a7804 100644 --- a/CallbackHandler/CallbackHandler.csproj +++ b/CallbackHandler/CallbackHandler.csproj @@ -6,6 +6,7 @@ + diff --git a/CallbackHandler/Program.cs b/CallbackHandler/Program.cs index 5550a35..648bb0f 100644 --- a/CallbackHandler/Program.cs +++ b/CallbackHandler/Program.cs @@ -42,7 +42,11 @@ public static IHostBuilder CreateHostBuilder(string[] args) IConfigurationRoot config = new ConfigurationBuilder().SetBasePath(fi.Directory.FullName) .AddJsonFile("hosting.json", optional: true) .AddJsonFile("hosting.development.json", optional: true) - .AddEnvironmentVariables().Build(); + .AddEnvironmentVariables() + .AddInMemoryCollection(new Dictionary + { + ["HealthMonitoring:Service:Version"] = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0" + }).Build(); ConfigureLogging(); diff --git a/CallbackHandler/appsettings.json b/CallbackHandler/appsettings.json index e0cfbed..5eb1c12 100644 --- a/CallbackHandler/appsettings.json +++ b/CallbackHandler/appsettings.json @@ -6,5 +6,19 @@ "Url": "http://localhost:5010/health", "IntervalInSeconds": 60 } + }, + "HealthMonitoring": { + "Service": { + "ServiceId": "callback-handler", + "Name": "Callback Handler", + "Description": "Callback Handler", + "HealthUrl": "http://localhost:5010/healthui" + }, + "Dependencies": [ + { + "DependencyName": "Eventstore", + "TargetServiceId": "kurrentdb" + } + ] } } diff --git a/Directory.Packages.props b/Directory.Packages.props index ca7c5ec..f39c2a7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,6 +3,7 @@ true + From a29aa972361b7e49b4e9d6bf0410663459081f75 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Mon, 21 Sep 2026 19:11:22 +0100 Subject: [PATCH 2/3] remove uptime kuma --- CallbackHandler/Startup.cs | 7 ------- CallbackHandler/appsettings.json | 8 -------- 2 files changed, 15 deletions(-) diff --git a/CallbackHandler/Startup.cs b/CallbackHandler/Startup.cs index 175f0c2..2699543 100644 --- a/CallbackHandler/Startup.cs +++ b/CallbackHandler/Startup.cs @@ -108,13 +108,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF app.UseSwagger(); app.UseSwaggerUI(); - - lifetime.ApplicationStarted.Register(() => - { - host.RegisterWithUptimeKumaAsync() - .GetAwaiter() - .GetResult(); - }); } } } diff --git a/CallbackHandler/appsettings.json b/CallbackHandler/appsettings.json index 5eb1c12..d5460ff 100644 --- a/CallbackHandler/appsettings.json +++ b/CallbackHandler/appsettings.json @@ -1,12 +1,4 @@ { - - "UptimeKuma": { - "Monitor": { - "Name": "Callback Handler", - "Url": "http://localhost:5010/health", - "IntervalInSeconds": 60 - } - }, "HealthMonitoring": { "Service": { "ServiceId": "callback-handler", From 2cdd879d59158db7e705d067a1c50dac527de663 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Mon, 21 Sep 2026 19:47:54 +0100 Subject: [PATCH 3/3] fix failing health registration --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f39c2a7..80aba1a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,7 +3,7 @@ true - +