Guard against agent config file schema validation errors preventing agent startup; unify framework/core behavior #835
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A recent support ticket (NR internal-only link) had to do with an exception being thrown during
newrelic.config
schema validation. They were using the .NET Framework agent and were getting an error like this:The root cause of why this customer was having the problem was never found. However, in looking at the code for reading the config schema .xsd, we found that the framework agent and core agent had different behaviors: the framework agent was depending on reading the schema as an embedded resource from one of the agent's DLLs, whereas the core agent just read the file from disk. Since the
newrelic.xsd
file is present for both agents, we decided to just use the core agent behavior for both.Additionally, and perhaps more importantly, we put exception handling around the schema validation so that any error in this process will not prevent agent startup.
Unit tests pass locally. Unit tests were refactored to no longer depend on the config schema being an embedded resource in the agent's core DLL, and the embedded resource was removed. Added a new unit test to cover the expected behavior if the config schema file is missing or empty.
I don't think we have or need any integration tests around this, nor is performance testing warranted. I also don't think a changelog entry is needed since this change should be completely transparent to users.
Reviewer Checklist