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 =
LoggerMessage.Define<string>(LogLevel.Trace, new EventId(5, "ConnectionTimedOut"), "Connection {TransportConnectionId} timed out.");
private static readonly Action<ILogger, Exception> _scanningConnections =
LoggerMessage.Define(LogLevel.Trace, new EventId(6, "ScanningConnections"), "Scanning connections.");
// 6, ScanningConnections - removed
private static readonly Action<ILogger, Exception> _scanningConnectionsFailed =
LoggerMessage.Define(LogLevel.Error, new EventId(7, "ScanningConnectionsFailed"), "Scanning connections failed.");
private static readonly Action<ILogger, TimeSpan, Exception> _scannedConnections =
LoggerMessage.Define<TimeSpan>(LogLevel.Trace, new EventId(8, "ScannedConnections"), "Scanned connections in {Duration}.");
// 8, ScannedConnections - removed
private static readonly Action<ILogger, Exception> _heartbeatStarted =
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);
}
public static void ScanningConnections(ILogger logger)
{
_scanningConnections(logger, null);
}
public static void ScanningConnectionsFailed(ILogger logger, Exception exception)
{
_scanningConnectionsFailed(logger, exception);
}
public static void ScannedConnections(ILogger logger, TimeSpan duration)
{
_scannedConnections(logger, duration, null);
}
public static void HeartBeatStarted(ILogger logger)
{
_heartbeatStarted(logger, null);

View File

@ -131,11 +131,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
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
foreach (var c in _connections)
{
@ -175,10 +170,6 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
connection.TickHeartbeat();
}
}
var elapsed = timer.GetElapsedTime();
HttpConnectionsEventSource.Log.ScannedConnections(elapsed);
Log.ScannedConnections(_logger, elapsed);
}
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}'.")]
public ValueStopwatch ConnectionStart(string connectionId)
{
@ -85,16 +76,8 @@ namespace Microsoft.AspNetCore.Http.Connections.Internal
}
}
[Event(eventId: 4, Level = EventLevel.Verbose, Message = "Scanning connections.")]
public void ScanningConnections()
{
if (IsEnabled() && IsEnabled(EventLevel.Verbose, EventKeywords.None))
{
WriteEvent(4);
}
}
// 4, ScanningConnections - removed
[Event(eventId: 5, Level = EventLevel.Verbose, Message = "Finished scanning connections. Duration: {0:0.00}ms.")]
private void ScannedConnections(double durationInMilliseconds) => WriteEvent(5, durationInMilliseconds);
// 5, ScannedConnections - removed
}
}