Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove whitespace from instrumentation parameters #461

Merged
merged 5 commits into from
Feb 16, 2021

Conversation

nr-ahemsath
Copy link
Member

Description

Resolves #169 by removing whitespace characters from the parameter list in a custom instrumentation XML method matcher.

Testing

Added unit test for matching multiple parameters with a space between the comma and the second parameter type.

Manually tested custom instrumentation matching a method with multiple parameters, with spaces between the parameters in the list, like this:

Method in code:
static void doSomething(int aNumber, bool aBool, string aString)
Method matcher in CI XML:
<exactMethodMatcher methodName="doSomething" parameters="System.Int32, System.Boolean, System.String" />

Tested on both Windows and Linux. With the current released profiler, this CI would not match and this method would not be instrumented. With the profiler built from this PR branch, the CI matches the method and the method is instrumented.

Changelog

Updated changelog.

}

// void as the parameters means parameterless method call (not all overloads)
if (Strings::AreEqualCaseInsensitive(*(rawParams), _X("void")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to this PR but rather interesting to me. I don't know if void parameter is a thing in C#. It is a thing in C++ or C but we are instrumenting C# functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually found my answer. Whatever method signatures we declare in the instrumetation xml are IL method signatures as opposed to C# or languages. So I believe void parameter is a thing in IL world.

@lspangler584
Copy link
Contributor

lspangler584 commented Feb 13, 2021

We should add the newly built NewRelic.Profiler.dlls to _profilerBuild folders.

@lspangler584
Copy link
Contributor

Ran unit tests, Profiler tests, IntegrationTests. Looks good.

@nr-ahemsath nr-ahemsath merged commit 65bbe64 into main Feb 16, 2021
@nr-ahemsath nr-ahemsath deleted the remove-whitespace-from-instrumentation-parameters branch February 16, 2021 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profiler should be able to match method parameters from XML that contain a space. Trim it !
3 participants