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/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 e0cfbed..d5460ff 100644 --- a/CallbackHandler/appsettings.json +++ b/CallbackHandler/appsettings.json @@ -1,10 +1,16 @@ { - - "UptimeKuma": { - "Monitor": { + "HealthMonitoring": { + "Service": { + "ServiceId": "callback-handler", "Name": "Callback Handler", - "Url": "http://localhost:5010/health", - "IntervalInSeconds": 60 - } + "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..80aba1a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,6 +3,7 @@ true +