Skip to content

Commit

Permalink
Use endpoints logical address to generate performance counters (#4173)
Browse files Browse the repository at this point in the history
* use endpoints logical address to generate performance counters
* rename ctor parameter
  • Loading branch information
timbussmann authored and danielmarbach committed Sep 28, 2016
1 parent 12cd213 commit fc7ef8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/NServiceBus.Core/Performance/ReceiveStatisticsFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public ReceiveStatisticsFeature()

protected internal override void Setup(FeatureConfigurationContext context)
{
var performanceDiagnosticsBehavior = new ReceivePerformanceDiagnosticsBehavior(context.Settings.LocalAddress());
var logicalAddress = context.Settings.LogicalAddress();
var performanceDiagnosticsBehavior = new ReceivePerformanceDiagnosticsBehavior(logicalAddress.EndpointInstance.Endpoint);

context.Pipeline.Register(performanceDiagnosticsBehavior, "Provides various performance counters for receive statistics");
context.Pipeline.Register("ProcessingStatistics", new ProcessingStatisticsBehavior(), "Collects timing for ProcessingStarted and adds the state to determine ProcessingEnded");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ namespace NServiceBus
[SkipWeaving]
class ReceivePerformanceDiagnosticsBehavior : IBehavior<IIncomingPhysicalMessageContext, IIncomingPhysicalMessageContext>
{
public ReceivePerformanceDiagnosticsBehavior(string transportAddress)
public ReceivePerformanceDiagnosticsBehavior(string queueName)
{
this.transportAddress = transportAddress;
this.queueName = queueName;
}

public void Warmup()
{
messagesPulledFromQueueCounter = PerformanceCounterHelper.TryToInstantiatePerformanceCounter(
"# of msgs pulled from the input queue /sec",
transportAddress);
queueName);
successRateCounter = PerformanceCounterHelper.TryToInstantiatePerformanceCounter(
"# of msgs successfully processed / sec",
transportAddress);
queueName);
failureRateCounter = PerformanceCounterHelper.TryToInstantiatePerformanceCounter(
"# of msgs failures / sec",
transportAddress);
queueName);
}

public async Task Invoke(IIncomingPhysicalMessageContext context, Func<IIncomingPhysicalMessageContext, Task> next)
Expand Down Expand Up @@ -54,6 +54,6 @@ public void Cooldown()
IPerformanceCounterInstance messagesPulledFromQueueCounter;
IPerformanceCounterInstance successRateCounter;

string transportAddress;
string queueName;
}
}

0 comments on commit fc7ef8e

Please sign in to comment.