Add prometheus exporters
This commit is contained in:
parent
f81833693d
commit
233337256f
|
@ -43,6 +43,9 @@
|
|||
<PackageReference Include="CommandLineParser" Version="2.7.82" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
|
||||
<PackageReference Include="prometheus-net" Version="3.5.0" />
|
||||
<PackageReference Include="prometheus-net.AspNetCore" Version="3.5.0" />
|
||||
<PackageReference Include="prometheus-net.DotNetRuntime" Version="3.3.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
|
||||
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
|
||||
|
|
|
@ -28,6 +28,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
|
|||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Prometheus.DotNetRuntime;
|
||||
using Serilog;
|
||||
using Serilog.Extensions.Logging;
|
||||
using SQLitePCL;
|
||||
|
@ -161,6 +162,9 @@ namespace Jellyfin.Server
|
|||
|
||||
ApplicationHost.LogEnvironmentInfo(_logger, appPaths);
|
||||
|
||||
// Initialize runtime stat collection
|
||||
IDisposable collector = DotNetRuntimeStatsBuilder.Default().StartCollecting();
|
||||
|
||||
// Make sure we have all the code pages we can get
|
||||
// Ref: https://docs.microsoft.com/en-us/dotnet/api/system.text.codepagesencodingprovider.instance?view=netcore-3.0#remarks
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Builder;
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Prometheus;
|
||||
|
||||
namespace Jellyfin.Server
|
||||
{
|
||||
|
@ -69,9 +70,11 @@ namespace Jellyfin.Server
|
|||
app.UseJellyfinApiSwagger();
|
||||
app.UseRouting();
|
||||
app.UseAuthorization();
|
||||
app.UseHttpMetrics(); // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapMetrics();
|
||||
});
|
||||
|
||||
app.Use(serverApplicationHost.ExecuteHttpHandlerAsync);
|
||||
|
|
Loading…
Reference in New Issue
Block a user