diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-04-29 11:36:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-29 11:36:05 +0200 |
| commit | 690fb65cd89d619cab168a871cbdfdfd12120009 (patch) | |
| tree | 6258f5ce76c15775ae940ab31d9ae686d5d34492 /Jellyfin.Server/Startup.cs | |
| parent | aff65adca93ef82d6c5d7765d18a69f7fd164f7c (diff) | |
| parent | e3a42a8fe93727d43d02a9b560a53661f12230b8 (diff) | |
Merge pull request #2985 from sparky8251/prometheus
Add Prometheus exporters
Diffstat (limited to 'Jellyfin.Server/Startup.cs')
| -rw-r--r-- | Jellyfin.Server/Startup.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Jellyfin.Server/Startup.cs b/Jellyfin.Server/Startup.cs index 4d7d56e9d..8bcfd1350 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 { @@ -69,9 +70,19 @@ namespace Jellyfin.Server 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); |
