-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Metrics switch support in the SDK #35418
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
Conversation
@eerhardt @dsplaisted could you please help reviewing this change? @artl93 @marcpopMSFT @ericstj for the merger approval to this rc2 branch. |
We'll be snapping Monday for RC2 so merge before then for inclusion. |
src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAProjectWithAllFeatures.cs
Outdated
Show resolved
Hide resolved
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
Outdated
Show resolved
Hide resolved
Approve this scenario. Thank you for testing end-to-end. Please consider @eerhardt's feedback and do any follow up e2e testing needed to confirm that change is needed. Maybe previously the linker wasn't replacing the body and runtime was just reading the appcontext swtich? Please double check the linker does the replacement. |
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.
LGTM. Thanks!
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.
Looks good.
What happens if you do something like <MetricsSupport>FileNotFound</MetricsSupport>
?
It looks like for other similar properties we don't do any validation that the value is valid, so it's probably fine as is.
src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs
Outdated
Show resolved
Hide resolved
…rary.cs Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
In the code we do the following to read the switch AppContext.TryGetSwitch("System.Diagnostics.Metrics.Meter.IsSupported", out bool isSupported) ? isSupported : true; So, if the value is defined with something that is not Update
|
Within the Runtime, we've introduced a configuration switch called
System.Diagnostics.Metrics.Meter.IsSupported
to manage the activation and deactivation of metrics functionality. This adjustment has been made to facilitate compatibility with the msbuild property namedMetricsSupport
.dotnet/runtime#89880
dotnet/runtime#92019
I have conducted comprehensive testing for the end-to-end scenario by configuring the
MetricsSupport
in a standalone application using the latest SDK and runtime. I've ensured that whenMetricsSupport
is absent or set totrue
in the csproj, the metrics functionality remains enabled. Conversely, when it's set tofalse
, the metrics functionality is disabled. You can find further details and context regarding the need for this switch in .NET 8.0 in the pull request located here: dotnet/runtime#92019, where an explanatory template outlines the rationale behind its implementation.