Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Prima.Application/Prima.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<PackageReference Include="Lumina" Version="3.15.2" />
<PackageReference Include="Lumina.Excel" Version="6.5.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="prometheus-net" Version="8.2.1" />
<PackageReference Include="prometheus-net.DotNetRuntime" Version="4.4.1" />
<PackageReference Include="Quartz" Version="3.14.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.14.0" />
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.14.0" />
Expand Down
20 changes: 20 additions & 0 deletions src/Prima.Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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") ??
Expand All @@ -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,
Expand Down Expand Up @@ -94,7 +114,7 @@
// Add scheduler
sc.AddQuartz(q =>
{
q.UseMicrosoftDependencyInjectionJobFactory();

Check warning on line 117 in src/Prima.Application/Program.cs

View workflow job for this annotation

GitHub Actions / dotnet_build

'IServiceCollectionQuartzConfigurator.UseMicrosoftDependencyInjectionJobFactory(Action<JobFactoryOptions>?)' is obsolete: 'MicrosoftDependencyInjectionJobFactory is the default for DI configuration, this method will be removed later on'

q.ScheduleJob<CheckDelubrumSavageEventsJob>(
t => t
Expand Down
1 change: 1 addition & 0 deletions src/Prima/Prima.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" />
<PackageReference Include="MongoDB.Driver" Version="3.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="prometheus-net" Version="8.2.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.2.0" />
Expand Down
Loading