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

549 fix auto init modules #730

Merged
merged 6 commits into from
Mar 8, 2018
Merged

Conversation

TimothyMothra
Copy link
Member

@TimothyMothra TimothyMothra commented Mar 8, 2018

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:

  • Design discussion issue #
  • Changes in public surface reviewed
  • CHANGELOG.md updated with one line description of the fix, and a link to the original issue.
  • The PR will trigger build, unit test, and functional tests automatically. If your PR was submitted from fork - mention one of committers to initiate the build for you.

@TimothyMothra TimothyMothra changed the title Tilee/549 fix auto init modules 549 fix auto init modules Mar 8, 2018
Copy link
Contributor

@d3r3kk d3r3kk left a 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
Copy link
Contributor

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);
Copy link
Contributor

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 ITelemetryModules 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).

Copy link
Member Author

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.

@TimothyMothra TimothyMothra merged commit c81621a into develop Mar 8, 2018
@TimothyMothra TimothyMothra deleted the tilee/549_fix_auto_init_modules branch March 8, 2018 21:34
TimothyMothra pushed a commit that referenced this pull request Oct 25, 2019
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.

3 participants