Address reviews

This commit is contained in:
sparky8251 2020-04-27 08:42:46 -04:00
parent 997b71bbef
commit e3a42a8fe9
3 changed files with 3 additions and 35 deletions

View File

@ -263,7 +263,7 @@ namespace Emby.Server.Implementations
// Initialize runtime stat collection // Initialize runtime stat collection
if (ServerConfigurationManager.Configuration.EnableMetrics) if (ServerConfigurationManager.Configuration.EnableMetrics)
{ {
IDisposable collector = DotNetRuntimeStatsBuilder.Default().StartCollecting(); DotNetRuntimeStatsBuilder.Default().StartCollecting();
} }
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));

View File

@ -1,33 +0,0 @@
using System;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Server.Migrations.Routines
{
/// <summary>
/// Disable metrics collections for all installations since it can be a security risk if not properly secured.
/// </summary>
internal class DisableMetricsCollection : IMigrationRoutine
{
/// <inheritdoc/>
public Guid Id => Guid.Parse("{4124C2CD-E939-4FFB-9BE9-9B311C413638}");
/// <inheritdoc/>
public string Name => "DisableMetricsCollection";
/// <inheritdoc/>
public void Perform(CoreAppHost host, ILogger logger)
{
// Set EnableMetrics to false since it can leak sensitive information if not properly secured
var metrics = host.ServerConfigurationManager.Configuration.EnableMetrics;
if (metrics)
{
logger.LogInformation("Disabling metrics collection during migration");
metrics = false;
host.ServerConfigurationManager.SaveConfiguration("false", metrics);
}
}
}
}

View File

@ -72,7 +72,8 @@ namespace Jellyfin.Server
app.UseAuthorization(); app.UseAuthorization();
if (_serverConfigurationManager.Configuration.EnableMetrics) if (_serverConfigurationManager.Configuration.EnableMetrics)
{ {
app.UseHttpMetrics(); // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad // Must be registered after any middleware that could chagne HTTP response codes or the data will be bad
app.UseHttpMetrics();
} }
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>