-
Notifications
You must be signed in to change notification settings - Fork 1.1k
A handful of S.CL-related cleanups and reorgs from the OTel branch to minimize diffs #50164
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
base: main
Are you sure you want to change the base?
A handful of S.CL-related cleanups and reorgs from the OTel branch to minimize diffs #50164
Conversation
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.
Pull Request Overview
This PR refactors the dotnet CLI to improve System.CommandLine (S.CL) usage patterns and code organization. The changes prepare the codebase for OpenTelemetry integration by removing performance measurement handling from the main command processing flow and adopting S.CL's Action pipeline for cross-cutting behaviors.
Key Changes:
- Reorganizes Program.cs into focused sub-methods for better readability and maintainability
- Adopts S.CL's Action pipeline for options like --version, --info, and --diagnostic that have behaviors attached
- Removes performance measurement tracking from telemetry tests and command processing
- Adopts nullable reference types across several files to improve type safety
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
test/dotnet.Tests/TelemetryCommandTest.cs | Removes performance measurement testing and simplifies test assertions |
src/Cli/dotnet/Telemetry/Telemetry.cs | Adopts nullable reference types for telemetry properties and parameters |
src/Cli/dotnet/Program.cs | Major reorganization into focused methods with nullable adoption and Activity-based tracing |
src/Cli/dotnet/PerformanceLogEventSource.cs | Adopts nullable reference types for startup information parameters |
src/Cli/dotnet/Parser.cs | Implements S.CL Action classes for --version and --info options |
src/Cli/dotnet/Extensions/ParseResultExtensions.cs | Simplifies extension methods and removes unused functionality |
src/Cli/dotnet/CommonOptionsFactory.cs | Implements S.CL Action for diagnostic mode option |
src/Cli/Microsoft.DotNet.Cli.Utils/Activities.cs | Adds tracing constants for cross-process activity tracking |
/// <summary> | ||
/// The environment variable used to transfer the chain of parent activity IDs. | ||
/// This should be used when constructing new sub-processes in order to | ||
/// track spans across calls. | ||
/// </summary> | ||
public const string TRACEPARENT = nameof(TRACEPARENT); | ||
/// <summary> | ||
/// The environment variable used to transfer the trace state of the parent activities. | ||
/// This should be used when constructing new sub-processes in order to | ||
/// track spans across calls. | ||
/// </summary> | ||
public const string TRACESTATE = nameof(TRACESTATE); |
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.
TRACEPARENT and TRACESTATE are added in #50163 too. I'd prefer having them added in only one pull request.
Do you intend to insert any new entries into Activity.TraceStateString, or just pass it through unchanged?
This slices off a few S.CL usability refactors off of #49409 to minimize the diff on that monstrosity.
This set of changes