Remove scanning connections log messages (#2397)

This commit is contained in:
James Newton-King 2018-05-30 15:29:46 +12:00 committed by GitHub
parent 508e66ece6
commit 8d680db112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 42 deletions

View File

@ -25,14 +25,12 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
private static readonly Action<ILogger, string, Exception> _connectionTimedOut = private static readonly Action<ILogger, string, Exception> _connectionTimedOut =
LoggerMessage.Define<string>(LogLevel.Trace, new EventId(5, "ConnectionTimedOut"), "Connection {TransportConnectionId} timed out."); LoggerMessage.Define<string>(LogLevel.Trace, new EventId(5, "ConnectionTimedOut"), "Connection {TransportConnectionId} timed out.");
private static readonly Action<ILogger, Exception> _scanningConnections = // 6, ScanningConnections - removed
LoggerMessage.Define(LogLevel.Trace, new EventId(6, "ScanningConnections"), "Scanning connections.");
private static readonly Action<ILogger, Exception> _scanningConnectionsFailed = private static readonly Action<ILogger, Exception> _scanningConnectionsFailed =
LoggerMessage.Define(LogLevel.Error, new EventId(7, "ScanningConnectionsFailed"), "Scanning connections failed."); LoggerMessage.Define(LogLevel.Error, new EventId(7, "ScanningConnectionsFailed"), "Scanning connections failed.");
private static readonly Action<ILogger, TimeSpan, Exception> _scannedConnections = // 8, ScannedConnections - removed
LoggerMessage.Define<TimeSpan>(LogLevel.Trace, new EventId(8, "ScannedConnections"), "Scanned connections in {Duration}.");
private static readonly Action<ILogger, Exception> _heartbeatStarted = private static readonly Action<ILogger, Exception> _heartbeatStarted =
LoggerMessage.Define(LogLevel.Trace, new EventId(9, "HeartBeatStarted"), "Starting connection heartbeat."); LoggerMessage.Define(LogLevel.Trace, new EventId(9, "HeartBeatStarted"), "Starting connection heartbeat.");
@ -65,21 +63,11 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
_connectionReset(logger, connectionId, exception); _connectionReset(logger, connectionId, exception);
} }
public static void ScanningConnections(ILogger logger)
{
_scanningConnections(logger, null);
}
public static void ScanningConnectionsFailed(ILogger logger, Exception exception) public static void ScanningConnectionsFailed(ILogger logger, Exception exception)
{ {
_scanningConnectionsFailed(logger, exception); _scanningConnectionsFailed(logger, exception);
} }
public static void ScannedConnections(ILogger logger, TimeSpan duration)
{
_scannedConnections(logger, duration, null);
}
public static void HeartBeatStarted(ILogger logger) public static void HeartBeatStarted(ILogger logger)
{ {
_heartbeatStarted(logger, null); _heartbeatStarted(logger, null);

View File

@ -131,11 +131,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
public async Task ScanAsync() public async Task ScanAsync()
{ {
// Time the scan so we know if it gets slower than 1sec
var timer = ValueStopwatch.StartNew();
HttpConnectionsEventSource.Log.ScanningConnections();
Log.ScanningConnections(_logger);
// Scan the registered connections looking for ones that have timed out // Scan the registered connections looking for ones that have timed out
foreach (var c in _connections) foreach (var c in _connections)
{ {
@ -175,10 +170,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
connection.TickHeartbeat(); connection.TickHeartbeat();
} }
} }
var elapsed = timer.GetElapsedTime();
HttpConnectionsEventSource.Log.ScannedConnections(elapsed);
Log.ScannedConnections(_logger, elapsed);
} }
public void CloseConnections() public void CloseConnections()

View File

@ -43,15 +43,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
} }
} }
[NonEvent]
public void ScannedConnections(TimeSpan duration)
{
if (IsEnabled() && IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
ScannedConnections(duration.TotalMilliseconds);
}
}
[Event(eventId: 1, Level = EventLevel.Informational, Message = "Started connection '{0}'.")] [Event(eventId: 1, Level = EventLevel.Informational, Message = "Started connection '{0}'.")]
public ValueStopwatch ConnectionStart(string connectionId) public ValueStopwatch ConnectionStart(string connectionId)
{ {
@ -85,16 +76,8 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
} }
} }
[Event(eventId: 4, Level = EventLevel.Verbose, Message = "Scanning connections.")] // 4, ScanningConnections - removed
public void ScanningConnections()
{
if (IsEnabled() && IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
WriteEvent(4);
}
}
[Event(eventId: 5, Level = EventLevel.Verbose, Message = "Finished scanning connections. Duration: {0:0.00}ms.")] // 5, ScannedConnections - removed
private void ScannedConnections(double durationInMilliseconds) => WriteEvent(5, durationInMilliseconds);
} }
} }