Added NoOp Performance Counter Manager

This commit is contained in:
Keivan Beigi 2016-12-08 18:37:46 -08:00
parent 7dbacf105d
commit 327536b684
4 changed files with 60 additions and 2 deletions

View File

@ -4,7 +4,7 @@ using System.Diagnostics;
namespace Microsoft.AspNet.SignalR.Infrastructure
{
internal class NoOpPerformanceCounter : IPerformanceCounter
public class NoOpPerformanceCounter : IPerformanceCounter
{
public string CounterName
{

View File

@ -55,6 +55,7 @@
<Compile Include="Serializer.cs" />
<Compile Include="SignalrDependencyResolver.cs" />
<Compile Include="SignalRMessage.cs" />
<Compile Include="SonarrPerformanceCounterManager.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNet.SignalR.Core\Microsoft.AspNet.SignalR.Core.csproj">

View File

@ -1,5 +1,6 @@
using System;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Infrastructure;
using NzbDrone.Common.Composition;
namespace NzbDrone.SignalR
@ -16,6 +17,8 @@ namespace NzbDrone.SignalR
private SignalrDependencyResolver(IContainer container)
{
_container = container;
var performanceCounterManager = new SonarrPerformanceCounterManager();
Register(typeof(IPerformanceCounterManager), () => performanceCounterManager);
}
public override object GetService(Type serviceType)

View File

@ -0,0 +1,54 @@
using System.Threading;
using Microsoft.AspNet.SignalR.Infrastructure;
namespace NzbDrone.SignalR
{
public class SonarrPerformanceCounterManager : IPerformanceCounterManager
{
private readonly IPerformanceCounter _counter = new NoOpPerformanceCounter();
public void Initialize(string instanceName, CancellationToken hostShutdownToken)
{
}
public IPerformanceCounter LoadCounter(string categoryName, string counterName, string instanceName, bool isReadOnly)
{
return _counter;
}
public IPerformanceCounter ConnectionsConnected => _counter;
public IPerformanceCounter ConnectionsReconnected => _counter;
public IPerformanceCounter ConnectionsDisconnected => _counter;
public IPerformanceCounter ConnectionsCurrent => _counter;
public IPerformanceCounter ConnectionMessagesReceivedTotal => _counter;
public IPerformanceCounter ConnectionMessagesSentTotal => _counter;
public IPerformanceCounter ConnectionMessagesReceivedPerSec => _counter;
public IPerformanceCounter ConnectionMessagesSentPerSec => _counter;
public IPerformanceCounter MessageBusMessagesReceivedTotal => _counter;
public IPerformanceCounter MessageBusMessagesReceivedPerSec => _counter;
public IPerformanceCounter ScaleoutMessageBusMessagesReceivedPerSec => _counter;
public IPerformanceCounter MessageBusMessagesPublishedTotal => _counter;
public IPerformanceCounter MessageBusMessagesPublishedPerSec => _counter;
public IPerformanceCounter MessageBusSubscribersCurrent => _counter;
public IPerformanceCounter MessageBusSubscribersTotal => _counter;
public IPerformanceCounter MessageBusSubscribersPerSec => _counter;
public IPerformanceCounter MessageBusAllocatedWorkers => _counter;
public IPerformanceCounter MessageBusBusyWorkers => _counter;
public IPerformanceCounter MessageBusTopicsCurrent => _counter;
public IPerformanceCounter ErrorsAllTotal => _counter;
public IPerformanceCounter ErrorsAllPerSec => _counter;
public IPerformanceCounter ErrorsHubResolutionTotal => _counter;
public IPerformanceCounter ErrorsHubResolutionPerSec => _counter;
public IPerformanceCounter ErrorsHubInvocationTotal => _counter;
public IPerformanceCounter ErrorsHubInvocationPerSec => _counter;
public IPerformanceCounter ErrorsTransportTotal => _counter;
public IPerformanceCounter ErrorsTransportPerSec => _counter;
public IPerformanceCounter ScaleoutStreamCountTotal => _counter;
public IPerformanceCounter ScaleoutStreamCountOpen => _counter;
public IPerformanceCounter ScaleoutStreamCountBuffering => _counter;
public IPerformanceCounter ScaleoutErrorsTotal => _counter;
public IPerformanceCounter ScaleoutErrorsPerSec => _counter;
public IPerformanceCounter ScaleoutSendQueueLength => _counter;
}
}