Skip to content

Commit

Permalink
chore: Warn if OpenTracing is detected (#2513)
Browse files Browse the repository at this point in the history
  • Loading branch information
chynesNR authored May 29, 2024
1 parent 8dac509 commit 45f0e59
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@ SPDX-License-Identifier: Apache-2.0
<exactMethodMatcher methodName="RunAsync" />
</match>
</tracerFactory>
<!-- We want to detect if the OpenTracing solution is running, as it is not compatible with the full Agent. -->
<tracerFactory name="OpenTracingWrapper">
<match assemblyName="NewRelic.OpenTracing.AmazonLambda.Tracer" className="NewRelic.OpenTracing.AmazonLambda.LambdaTracer">
<exactMethodMatcher methodName=".ctor" />
</match>
</tracerFactory>
</instrumentation>
</extension>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using NewRelic.Agent.Api;
using NewRelic.Agent.Extensions.Providers.Wrapper;

namespace NewRelic.Providers.Wrapper.AwsLambda
{
public class OpenTracingWrapper : IWrapper
{
private const string WrapperName = "OpenTracingWrapper";

public bool IsTransactionRequired => false;

public CanWrapResponse CanWrap(InstrumentedMethodInfo methodInfo)
{
return new CanWrapResponse(WrapperName.Equals(methodInfo.RequestedWrapperName));
}

public AfterWrappedMethodDelegate BeforeWrappedMethod(InstrumentedMethodCall instrumentedMethodCall, IAgent agent, ITransaction transaction)
{
agent.Logger.Log(Agent.Extensions.Logging.Level.Warn, "OpenTracing is not compatible with the full .NET Agent and may result in undefined behavior. Please remove OpenTracing from your application.");
return Delegates.NoOp;
}
}
}

0 comments on commit 45f0e59

Please sign in to comment.