diff --git a/src/Agent/NewRelic/Agent/Core/Metrics/MetricNames.cs b/src/Agent/NewRelic/Agent/Core/Metrics/MetricNames.cs
index 2f399603a7..81c08c4bd1 100644
--- a/src/Agent/NewRelic/Agent/Core/Metrics/MetricNames.cs
+++ b/src/Agent/NewRelic/Agent/Core/Metrics/MetricNames.cs
@@ -353,6 +353,9 @@ public enum MessageBrokerAction
Consume,
Peek,
Purge,
+ Process,
+ Settle,
+ Cancel
}
public const string MessageBrokerPrefix = "MessageBroker";
diff --git a/src/Agent/NewRelic/Agent/Core/Transactions/Transaction.cs b/src/Agent/NewRelic/Agent/Core/Transactions/Transaction.cs
index 9cbe293901..a6c93f9d65 100644
--- a/src/Agent/NewRelic/Agent/Core/Transactions/Transaction.cs
+++ b/src/Agent/NewRelic/Agent/Core/Transactions/Transaction.cs
@@ -414,6 +414,12 @@ private static MetricNames.MessageBrokerAction AgentWrapperApiEnumToMetricNamesE
return MetricNames.MessageBrokerAction.Produce;
case MessageBrokerAction.Purge:
return MetricNames.MessageBrokerAction.Purge;
+ case MessageBrokerAction.Process:
+ return MetricNames.MessageBrokerAction.Process;
+ case MessageBrokerAction.Settle:
+ return MetricNames.MessageBrokerAction.Settle;
+ case MessageBrokerAction.Cancel:
+ return MetricNames.MessageBrokerAction.Cancel;
default:
throw new InvalidOperationException("Unexpected enum value: " + wrapper);
}
diff --git a/src/Agent/NewRelic/Agent/Extensions/NewRelic.Agent.Extensions/Providers/Wrapper/Constants.cs b/src/Agent/NewRelic/Agent/Extensions/NewRelic.Agent.Extensions/Providers/Wrapper/Constants.cs
index 116c412f80..6457accbf9 100644
--- a/src/Agent/NewRelic/Agent/Extensions/NewRelic.Agent.Extensions/Providers/Wrapper/Constants.cs
+++ b/src/Agent/NewRelic/Agent/Extensions/NewRelic.Agent.Extensions/Providers/Wrapper/Constants.cs
@@ -59,6 +59,9 @@ public enum MessageBrokerAction
Consume,
Peek,
Purge,
+ Process,
+ Settle,
+ Cancel
}
///This enum must be a sequence of values starting with 0 and incrementing by 1. See MetricNames.GetEnumerationFunc
diff --git a/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusProcessorWrapper.cs b/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusProcessorWrapper.cs
new file mode 100644
index 0000000000..f46154639b
--- /dev/null
+++ b/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusProcessorWrapper.cs
@@ -0,0 +1,36 @@
+// Copyright 2020 New Relic, Inc. All rights reserved.
+// SPDX-License-Identifier: Apache-2.0
+
+using System.Threading.Tasks;
+using NewRelic.Agent.Api;
+using NewRelic.Agent.Extensions.Providers.Wrapper;
+
+namespace NewRelic.Providers.Wrapper.AzureServiceBus;
+
+public class AzureServiceBusProcessorWrapper : AzureServiceBusWrapperBase
+{
+ public override bool IsTransactionRequired => true;
+
+ public override CanWrapResponse CanWrap(InstrumentedMethodInfo instrumentedMethodInfo)
+ {
+ var canWrap = instrumentedMethodInfo.RequestedWrapperName.Equals(nameof(AzureServiceBusProcessorWrapper));
+ return new CanWrapResponse(canWrap);
+ }
+
+ public override AfterWrappedMethodDelegate BeforeWrappedMethod(InstrumentedMethodCall instrumentedMethodCall, IAgent agent, ITransaction transaction)
+ {
+ if (instrumentedMethodCall.IsAsync)
+ transaction.AttachToAsync();
+
+ // this call wraps the client event handler callback, so start a method segment that will time the callback
+ var segment = transaction.StartMethodSegment(
+ instrumentedMethodCall.MethodCall,
+ instrumentedMethodCall.MethodCall.Method.Type.Name,
+ instrumentedMethodCall.MethodCall.Method.MethodName);
+
+ return instrumentedMethodCall.IsAsync ?
+ Delegates.GetAsyncDelegateFor(agent, segment)
+ :
+ Delegates.GetDelegateFor(segment);
+ }
+}
diff --git a/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusReceiveWrapper.cs b/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusReceiveWrapper.cs
index 01e58c33f8..8ca4852379 100644
--- a/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusReceiveWrapper.cs
+++ b/src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AzureServiceBus/AzureServiceBusReceiveWrapper.cs
@@ -16,6 +16,11 @@ public class AzureServiceBusReceiveWrapper : AzureServiceBusWrapperBase
{
private static readonly ConcurrentDictionary> _getResultFromGenericTask = new();
+ private Func