Skip to content

Commit 0525182

Browse files
authored
fix: Revert RabbitMQ HandleBasicDeliver instrumentation change from #1972. Resolves #2047 (#2118)
1 parent 6aae40d commit 0525182

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/RabbitMq/Instrumentation.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SPDX-License-Identifier: Apache-2.0
3030

3131
<!-- Consume Push / Event / Subscribe -->
3232
<tracerFactory name="HandleBasicDeliverWrapper">
33-
<match assemblyName="RabbitMQ.Client" className="RabbitMQ.Client.Impl.ModelBase">
33+
<match assemblyName="RabbitMQ.Client" className="RabbitMQ.Client.Events.EventingBasicConsumer">
3434
<exactMethodMatcher methodName="HandleBasicDeliver" />
3535
</match>
3636
</tracerFactory>

tests/Agent/IntegrationTests/SharedApplications/Common/MultiFunctionApplicationHelpers/NetStandardLibraries/RabbitMQ.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 New Relic, Inc. All rights reserved.
1+
// Copyright 2020 New Relic, Inc. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

44
// See this project's .csproj file for target framework => RabbitMQ.Client version mappings
@@ -227,11 +227,20 @@ void handler(object ch, BasicDeliverEventArgs basicDeliverEventArgs)
227227
#endif
228228
VerifyHeaders(basicDeliverEventArgs.BasicProperties.Headers);
229229

230+
InstrumentedChildMethod(); // to verify we're getting a child span
231+
230232
manualResetEvent.Set();
231233
}
232234
}
233235
}
234236

237+
[Trace]
238+
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
239+
private void InstrumentedChildMethod()
240+
{
241+
Thread.Sleep(100);
242+
}
243+
235244
private void VerifyHeaders(IDictionary<string, object> headers)
236245
{
237246
foreach (var userHeader in userHeaders)

tests/Agent/IntegrationTests/UnboundedIntegrationTests/RabbitMq/RabbitMqDistributedTracingTests.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public void Test()
5353
{
5454
new Assertions.ExpectedMetric { metricName = "Supportability/DistributedTrace/CreatePayload/Success", callCount = 3 },
5555
new Assertions.ExpectedMetric { metricName = "Supportability/TraceContext/Create/Success", callCount = 3 },
56-
new Assertions.ExpectedMetric { metricName = "Supportability/TraceContext/Accept/Success", callCount = 2 }
56+
new Assertions.ExpectedMetric { metricName = "Supportability/TraceContext/Accept/Success", callCount = 2 },
57+
new Assertions.ExpectedMetric { metricName = "DotNet/MultiFunctionApplicationHelpers.NetStandardLibraries.RabbitMQ/InstrumentedChildMethod"} ,
58+
new Assertions.ExpectedMetric { metricName = "DotNet/MultiFunctionApplicationHelpers.NetStandardLibraries.RabbitMQ/InstrumentedChildMethod", metricScope = "OtherTransaction/Message/RabbitMQ/Queue/Named/integrationTestQueue.*", IsRegexScope = true}
5759
};
5860

5961
var metrics = _fixture.AgentLog.GetMetrics();

0 commit comments

Comments
 (0)