You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm currently trying to switch my project which was based on OpenCensus to OpenTelemetry. This is an exercise in frustration, because apparently there is no way to make my existing tests work - thanks to improved protection of classes, constructors and methods by internal keyword. I'm not able to find a way to initialize stats component in isolation - it seems that the only way is to use static properties of Stats class, and I need a fresh state for each test. (Previously it was possible by instantiation of StatsComponent class.)
What about more flexible composition by dependency injection? I can see some reasons why this would be better:
external test scenarios involving OpenTelemetry components (my case),
possibility to create multiple instances of OpenTelemetry classes with separate configurations,
more flexibility with regards to component implementation,
option to reinitialize the stats / trace subsystem,
nice integration with .NET (Core) applications which already heavily rely on DI.
It could be still possible to perform initialization of (for example) stats subsystem by explicit instantiation of Stats class, with reasonable default configuration. Currently even if I remove constructor protection by internal keyword it won't help much, because the properties are static.
The text was updated successfully, but these errors were encountered:
Hello,
I'm currently trying to switch my project which was based on OpenCensus to OpenTelemetry. This is an exercise in frustration, because apparently there is no way to make my existing tests work - thanks to improved protection of classes, constructors and methods by
internal
keyword. I'm not able to find a way to initialize stats component in isolation - it seems that the only way is to use static properties ofStats
class, and I need a fresh state for each test. (Previously it was possible by instantiation ofStatsComponent
class.)What about more flexible composition by dependency injection? I can see some reasons why this would be better:
It could be still possible to perform initialization of (for example) stats subsystem by explicit instantiation of
Stats
class, with reasonable default configuration. Currently even if I remove constructor protection byinternal
keyword it won't help much, because the properties are static.The text was updated successfully, but these errors were encountered: