-
Notifications
You must be signed in to change notification settings - Fork 287
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
549 fix auto init modules #730
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some optional comments for you to consider.
Assert.IsTrue(((MockProcessorModule)tc1.TelemetryProcessors[0]).ModuleInitialized, "Module was not initialized."); | ||
} | ||
|
||
private class MockProcessorModule : ITelemetryProcessor, ITelemetryModule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is common practice inside test classes/files, but I still prefer to see mocks in their own sub-folder of the test. I'll leave it to you to decide whether or not this is important, as I don't think it's commonplace in our codebase as yet.
// If a Processor also implements ITelemtryModule, We should Initialize that Module | ||
if (linkedTelemetryProcessor is ITelemetryModule telemetryModule) | ||
{ | ||
telemetryModule.Initialize(this.configuration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We protect against re-initialization across thread boundaries in some of the ITelemetryModule
s I've seen and worked on. However, it is entirely possible that a 3rd party may not have done so. Would it be prudent to put this inside a try...catch block? (Please safely ignore this comment if there is an outer try catch I cannot see).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. We have no control over other implementations, and our own TelemetryConfigurationFactory calls Initialize in a try/catch. I'll do the same here.
Fix Issue #549 .
When
TelemetryProcessorChainBuilder
rebuilds Processors,Processors that implement
ITelemetryModule
may not get initialized via this workflow.For significant contributions please make sure you have completed the following items: