aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Startup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server/Startup.cs')
-rw-r--r--Jellyfin.Server/Startup.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Jellyfin.Server/Startup.cs b/Jellyfin.Server/Startup.cs
index 4d7d56e9d..5f9a5c161 100644
--- a/Jellyfin.Server/Startup.cs
+++ b/Jellyfin.Server/Startup.cs
@@ -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
{
@@ -63,15 +64,24 @@ namespace Jellyfin.Server
app.UseResponseCompression();
// TODO app.UseMiddleware<WebSocketMiddleware>();
- app.Use(serverApplicationHost.ExecuteWebsocketHandlerAsync);
// TODO use when old API is removed: app.UseAuthentication();
app.UseJellyfinApiSwagger();
app.UseRouting();
app.UseAuthorization();
+ if (_serverConfigurationManager.Configuration.EnableMetrics)
+ {
+ // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad
+ app.UseHttpMetrics();
+ }
+
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
+ if (_serverConfigurationManager.Configuration.EnableMetrics)
+ {
+ endpoints.MapMetrics(_serverConfigurationManager.Configuration.BaseUrl.TrimStart('/') + "/metrics");
+ }
});
app.Use(serverApplicationHost.ExecuteHttpHandlerAsync);