diff --git a/src/Prima.Application/Prima.Application.csproj b/src/Prima.Application/Prima.Application.csproj index bf8ae34..63dc027 100644 --- a/src/Prima.Application/Prima.Application.csproj +++ b/src/Prima.Application/Prima.Application.csproj @@ -23,6 +23,8 @@ + + diff --git a/src/Prima.Application/Program.cs b/src/Prima.Application/Program.cs index e120fc9..44503f4 100644 --- a/src/Prima.Application/Program.cs +++ b/src/Prima.Application/Program.cs @@ -27,6 +27,8 @@ using Prima.Game.FFXIV.FFLogs.Rules; using Prima.Game.FFXIV.XIVAPI; using Prima.Services; +using Prometheus; +using Prometheus.DotNetRuntime; using Quartz; var googleApiSecretPath = Environment.GetEnvironmentVariable("PRIMA_GOOGLE_SECRET") ?? @@ -48,6 +50,24 @@ var host = Host.CreateDefaultBuilder() .ConfigureServices((_, sc) => { + var metricsServer = new MetricServer(3000); + try + { + metricsServer.Start(); + } + catch (HttpListenerException ex) + { + // ReSharper disable LocalizableElement + Console.WriteLine($"Failed to start metric server: {ex.Message}"); + Console.WriteLine("You may need to grant permissions to your user account if not running as Administrator:"); + Console.WriteLine("netsh http add urlacl url=http://+:1234/metrics user=DOMAIN\\user"); + // ReSharper restore LocalizableElement + return; + } + + sc.AddSingleton(metricsServer); + sc.AddSingleton(DotNetRuntimeStatsBuilder.Default().StartCollecting()); + var disConfig = new DiscordSocketConfig { AlwaysDownloadUsers = true, diff --git a/src/Prima/Prima.csproj b/src/Prima/Prima.csproj index 176f000..a28b2c7 100644 --- a/src/Prima/Prima.csproj +++ b/src/Prima/Prima.csproj @@ -37,6 +37,7 @@ +