From fc7ef8e78da3aba64bf52226d0925236d38b9015 Mon Sep 17 00:00:00 2001 From: Tim Bussmann Date: Wed, 28 Sep 2016 15:49:34 +0200 Subject: [PATCH] Use endpoints logical address to generate performance counters (#4173) * use endpoints logical address to generate performance counters * rename ctor parameter --- .../Performance/ReceiveStatisticsFeature.cs | 3 ++- .../ReceivePerformanceDiagnosticsBehavior.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/NServiceBus.Core/Performance/ReceiveStatisticsFeature.cs b/src/NServiceBus.Core/Performance/ReceiveStatisticsFeature.cs index b537e352043..da796cdc0cb 100644 --- a/src/NServiceBus.Core/Performance/ReceiveStatisticsFeature.cs +++ b/src/NServiceBus.Core/Performance/ReceiveStatisticsFeature.cs @@ -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"); diff --git a/src/NServiceBus.Core/Performance/Statistics/ReceivePerformanceDiagnosticsBehavior.cs b/src/NServiceBus.Core/Performance/Statistics/ReceivePerformanceDiagnosticsBehavior.cs index 8e8757b194b..2581283cf06 100644 --- a/src/NServiceBus.Core/Performance/Statistics/ReceivePerformanceDiagnosticsBehavior.cs +++ b/src/NServiceBus.Core/Performance/Statistics/ReceivePerformanceDiagnosticsBehavior.cs @@ -8,22 +8,22 @@ namespace NServiceBus [SkipWeaving] class ReceivePerformanceDiagnosticsBehavior : IBehavior { - 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 next) @@ -54,6 +54,6 @@ public void Cooldown() IPerformanceCounterInstance messagesPulledFromQueueCounter; IPerformanceCounterInstance successRateCounter; - string transportAddress; + string queueName; } } \ No newline at end of file