Yohan Belval 1 month ago committed by GitHub
commit e810cfe6bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -260,6 +260,8 @@ namespace Emby.Server.Implementations
/// <inheritdoc/> /// <inheritdoc/>
public bool ListenWithHttps => Certificate is not null && ConfigurationManager.GetNetworkConfiguration().EnableHttps; public bool ListenWithHttps => Certificate is not null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;
public bool EnableMetrics => ConfigurationManager.Configuration.EnableMetrics || this._startupConfig.GetValue<bool>(EnableMetricsKey);
public string FriendlyName => public string FriendlyName =>
string.IsNullOrEmpty(ConfigurationManager.Configuration.ServerName) string.IsNullOrEmpty(ConfigurationManager.Configuration.ServerName)
? Environment.MachineName ? Environment.MachineName
@ -420,7 +422,7 @@ namespace Emby.Server.Implementations
NetManager = new NetworkManager(ConfigurationManager, _startupConfig, LoggerFactory.CreateLogger<NetworkManager>()); NetManager = new NetworkManager(ConfigurationManager, _startupConfig, LoggerFactory.CreateLogger<NetworkManager>());
// Initialize runtime stat collection // Initialize runtime stat collection
if (ConfigurationManager.Configuration.EnableMetrics) if (this.EnableMetrics)
{ {
DotNetRuntimeStatsBuilder.Default().StartCollecting(); DotNetRuntimeStatsBuilder.Default().StartCollecting();
} }

@ -19,7 +19,8 @@ namespace Emby.Server.Implementations
{ FfmpegAnalyzeDurationKey, "200M" }, { FfmpegAnalyzeDurationKey, "200M" },
{ PlaylistsAllowDuplicatesKey, bool.FalseString }, { PlaylistsAllowDuplicatesKey, bool.FalseString },
{ BindToUnixSocketKey, bool.FalseString }, { BindToUnixSocketKey, bool.FalseString },
{ SqliteCacheSizeKey, "20000" } { SqliteCacheSizeKey, "20000" },
{ EnableMetricsKey, bool.FalseString }
}; };
} }
} }

@ -211,7 +211,7 @@ namespace Jellyfin.Server
mainApp.UseWebSocketHandler(); mainApp.UseWebSocketHandler();
mainApp.UseServerStartupMessage(); mainApp.UseServerStartupMessage();
if (_serverConfigurationManager.Configuration.EnableMetrics) if (_serverApplicationHost.EnableMetrics)
{ {
// Must be registered after any middleware that could change HTTP response codes or the data will be bad // Must be registered after any middleware that could change HTTP response codes or the data will be bad
mainApp.UseHttpMetrics(); mainApp.UseHttpMetrics();
@ -220,7 +220,7 @@ namespace Jellyfin.Server
mainApp.UseEndpoints(endpoints => mainApp.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers(); endpoints.MapControllers();
if (_serverConfigurationManager.Configuration.EnableMetrics) if (_serverApplicationHost.EnableMetrics)
{ {
endpoints.MapMetrics(); endpoints.MapMetrics();
} }

@ -64,6 +64,11 @@ namespace MediaBrowser.Controller.Extensions
/// </summary> /// </summary>
public const string SqliteCacheSizeKey = "sqlite:cacheSize"; public const string SqliteCacheSizeKey = "sqlite:cacheSize";
/// <summary>
/// The key for enabling the metrics endpoint.
/// </summary>
public const string EnableMetricsKey = "EnableMetrics";
/// <summary> /// <summary>
/// Gets a value indicating whether the application should host static web content from the <see cref="IConfiguration"/>. /// Gets a value indicating whether the application should host static web content from the <see cref="IConfiguration"/>.
/// </summary> /// </summary>

@ -38,6 +38,11 @@ namespace MediaBrowser.Controller
/// <value>The name of the friendly.</value> /// <value>The name of the friendly.</value>
string FriendlyName { get; } string FriendlyName { get; }
/// <summary>
/// Gets a value indicating whether if the server should enable the metrics endpoint.
/// </summary>
bool EnableMetrics { get; }
/// <summary> /// <summary>
/// Gets a URL specific for the request. /// Gets a URL specific for the request.
/// </summary> /// </summary>

Loading…
Cancel
Save