-
Notifications
You must be signed in to change notification settings - Fork 385
Launch dsrouter from gcdump #5494
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
Launch dsrouter from gcdump #5494
Conversation
Continue the work of dotnet#5242 and add a --dsrouter switch to `dotnet-gcdump collect` fixes dotnet#5436
tommcdon
left a comment
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!
|
@StephaneDelcroix would you mind submitting a docs PR for the new --dsrouter switch on dotnet-gcdump? |
|
that's mainly unfinished work from last time |
lateralusX
left a comment
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!
|
|
/ba-g failures are unrelated |
|
We're going to need to give this another run through CI. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Context: #5494 Context: #5241 Fixes: #5435 We added `--dsrouter` switch to both `dotnet-trace` and `dotnet-gcdump`, which runs `dotnet-dsrouter` as a child process. Many of `dotnet-dsrouter`'s console messages are pretty useful for developers, but we are simply ignoring them: private static async Task ReadAndIgnoreAllStreamAsync(StreamReader streamToIgnore, CancellationToken cancelToken) { Memory<char> memory = new char[4096]; while (await streamToIgnore.ReadAsync(memory, cancelToken).ConfigureAwait(false) != 0) { } } To make this a bit more useful, we now log the output to either `Console.Out` or `Console.Error` where appropriate. If we simply did: string line; while ((line = await streamToRead.ReadLineAsync(cancelToken).ConfigureAwait(false)) != null) { output.WriteLine(line); } This would work fine, but we'd lose all coloring. `dotnet-dsrouter` uses `SimpleConsoleFormatter` to colorize its output: https://github.com/dotnet/runtime/blob/aadcceeb03ce0ecbc2ad645de0feb10189daa64c/src/libraries/Microsoft.Extensions.Logging.Console/src/SimpleConsoleFormatter.cs#L163-L199 So, for now, a very simple solution is to check the known prefixes and add coloring. This looks to have a pretty good result. I also dropped the duplicate message: WARNING: dotnet-dsrouter is a development tool not intended for production environments. Now that we print all of `dotnet-dsrouter`'s output, we can handle this case and color it yellow.
Context: #5494 Context: #5241 Fixes: #5435 We added `--dsrouter` switch to both `dotnet-trace` and `dotnet-gcdump`, which runs `dotnet-dsrouter` as a child process. Many of `dotnet-dsrouter`'s console messages are pretty useful for developers, but we are simply ignoring them: private static async Task ReadAndIgnoreAllStreamAsync(StreamReader streamToIgnore, CancellationToken cancelToken) { Memory<char> memory = new char[4096]; while (await streamToIgnore.ReadAsync(memory, cancelToken).ConfigureAwait(false) != 0) { } } To make this a bit more useful, we now log the output to either `Console.Out` or `Console.Error` where appropriate. If we simply did: string line; while ((line = await streamToRead.ReadLineAsync(cancelToken).ConfigureAwait(false)) != null) { output.WriteLine(line); } This would work fine, but we'd lose all coloring. `dotnet-dsrouter` uses `SimpleConsoleFormatter` to colorize its output: https://github.com/dotnet/runtime/blob/aadcceeb03ce0ecbc2ad645de0feb10189daa64c/src/libraries/Microsoft.Extensions.Logging.Console/src/SimpleConsoleFormatter.cs#L163-L199 So, for now, a very simple solution is to check the known prefixes and add coloring. This looks to have a pretty good result. I also dropped the duplicate message: WARNING: dotnet-dsrouter is a development tool not intended for production environments. Now that we print all of `dotnet-dsrouter`'s output, we can handle this case and color it yellow. <img width="2524" height="582" alt="image" src="https://github.com/user-attachments/assets/4924ec93-c616-4511-83f8-f318f4ce4471" />
Continue the work of #5242 and add a --dsrouter switch to
dotnet-gcdump collectfixes #5436