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

feat: Update profiler to support responding to changes in ignored instrumentation. #2236

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace NewRelic { namespace Profiler { namespace Configuration
class InstrumentationConfiguration
{
public:
InstrumentationConfiguration(InstrumentationXmlSetPtr instrumentationXmls, IgnoreInstrumentationListPtr ignoreList = nullptr) :
InstrumentationConfiguration(InstrumentationXmlSetPtr instrumentationXmls, IgnoreInstrumentationListPtr ignoreList) :
_instrumentationPointsSet(new InstrumentationPointSet())
, _ignoreList(ignoreList)
{
Expand All @@ -51,18 +51,16 @@ namespace NewRelic { namespace Profiler { namespace Configuration
continue;
}
}
LogInfo("Identified ", _instrumentationPointsSet->size(), " Instrumentation points in .xml files");
LogInfo("Identified ", _instrumentationPointsSet->size(), " Instrumentation points (not ignored) in .xml files");
}

InstrumentationConfiguration(InstrumentationPointSetPtr instrumentationPoints, IgnoreInstrumentationListPtr ignoreList = nullptr) :
_instrumentationPointsSet(instrumentationPoints)
InstrumentationConfiguration(InstrumentationPointSetPtr instrumentationPoints, IgnoreInstrumentationListPtr ignoreList) :
_instrumentationPointsSet(new InstrumentationPointSet())
, _ignoreList(ignoreList)
{
_instrumentationPointsSet = instrumentationPoints;

for (auto instrumentationPoint : *instrumentationPoints)
{
(*_instrumentationPointsMap)[instrumentationPoint->GetMatchKey()].insert(instrumentationPoint);
AddInstrumentationPointToCollectionsIfNotIgnored(instrumentationPoint);
}
}

Expand Down Expand Up @@ -93,12 +91,6 @@ namespace NewRelic { namespace Profiler { namespace Configuration
return nullptr;
}

if (IgnoreInstrumentation::Matches(_ignoreList, function->GetAssemblyName(), function->GetTypeName()))
{
LogDebug(function->GetFunctionName(), L" in ", function->GetAssemblyName(), L" will not be instrumented. It is in the ignore list in the config file.");
return nullptr;
}

// We may have multiple matching instrumentation points that target different assembly versions. See if we can find one that meets
// the version requirements
AssemblyVersion foundVersion(function->GetAssemblyProps());
Expand Down Expand Up @@ -353,8 +345,20 @@ namespace NewRelic { namespace Profiler { namespace Configuration

// finally add the new instrumentation point(s) to our set of instrumentation points
// Note that there may be "duplicated" instrumentation points that target different assembly versions
(*_instrumentationPointsMap)[iPoint->GetMatchKey()].insert(iPoint);
_instrumentationPointsSet->insert(iPoint);
AddInstrumentationPointToCollectionsIfNotIgnored(iPoint);
}
}

void AddInstrumentationPointToCollectionsIfNotIgnored(InstrumentationPointPtr instrumentationPoint)
{
if (!IgnoreInstrumentation::Matches(_ignoreList, instrumentationPoint->AssemblyName, instrumentationPoint->ClassName))
{
(*_instrumentationPointsMap)[instrumentationPoint->GetMatchKey()].insert(instrumentationPoint);
_instrumentationPointsSet->insert(instrumentationPoint);
}
else
{
LogDebug(L"Instrumentation for ", instrumentationPoint->GetMatchKey(), L" is in the ignore list in the newrelic.config file and will be ignored.");
}
}

Expand Down
Loading
Loading