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
Multiple IConfigurateOptions<MetricsServiceExtensions+NoOpOptions> aren't registered in DI. MetricsSubscriptionManager is initialized once.
Actual behavior
Multiple IConfigurateOptions<MetricsServiceExtensions+NoOpOptions> is registered in DI. Each will instance will call initialize on MetricsSubscriptionManager.
I noticed this when the AddMvc_Twice_DoesNotAddDuplicates test in aspnetcore started throwing because there were duplicate config options.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered:
This doesn't seem critical for rc1, there aren't currently any implementations of IMetricsListener.Initialize other than the console, and the early adopters can mitigate this in their own code until rc2.
Description
Calling
AddMetrics
initializes the subscription manager:runtime/src/libraries/Microsoft.Extensions.Diagnostics/src/Metrics/MetricsServiceExtensions.cs
Lines 33 to 35 in 64243bb
However, the way this is done isn't resilient to multiple calls to
AddMetrics
by app or library code.Listeners are initialized multiple times:
runtime/src/libraries/Microsoft.Extensions.Diagnostics/src/Metrics/MetricsSubscriptionManager.cs
Lines 30 to 36 in 64243bb
Reproduction Steps
Expected behavior
Multiple
IConfigurateOptions<MetricsServiceExtensions+NoOpOptions>
aren't registered in DI.MetricsSubscriptionManager
is initialized once.Actual behavior
Multiple
IConfigurateOptions<MetricsServiceExtensions+NoOpOptions>
is registered in DI. Each will instance will call initialize onMetricsSubscriptionManager
.I noticed this when the AddMvc_Twice_DoesNotAddDuplicates test in aspnetcore started throwing because there were duplicate config options.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: