Elfocrash / Cosmonaut

🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
https://cosmonaut.readthedocs.io
MIT License
342 stars 44 forks source link

AppInsightsTelemetryModule can only be used once #72

Open roberino opened 5 years ago

roberino commented 5 years ago

Typically applications only require one TelemetryConfiguration instance with one set of ITelemetryInitializer but we have a few cases where we have multiple configurations running within a single application. This problem has popped up in testing scenarios but also in odd cases where a component has implemented specific telemetry with a specific channel (and other configuration) different to the host application.

In these cases, the AppInsightsTelemetryModule is problematic because once the Initialize method has been called then all other TelemetryClient instances are ignored.

We have a similar problem with one of our ITelemetryModule implementations and have got around this by keeping a reference to multiple instances of the client - i.e. if a client has a different Instrumentation key then we reference it.

Is this something that can be addressed?