Skip to content
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

Tool for tracing live events? #663

Closed
adamsitnik opened this issue Dec 3, 2019 · 8 comments
Closed

Tool for tracing live events? #663

adamsitnik opened this issue Dec 3, 2019 · 8 comments
Labels
duplicate This issue or pull request already exists

Comments

@adamsitnik
Copy link
Member

While working on #623 and reviewing @tmds blog post about tracing .NET Core apps I've realized that we don't have any tool that would allow for tracing and viewing live events on Linux.

I can specify the list of providers to dotnet trace but I can't view the events without copying the nettrace file to Windows and opening it with PerfView. Or writing my own console line tool.

An example of a tool that works with ETW only: https://github.com/goldshtn/etrace

@noahfalk do we have any plans for a tool like this?

@TIHan
Copy link
Member

TIHan commented Dec 3, 2019

Just posting this as FYI. If you are on linux, there is an alternative to opening a nettrace file, and that would be using a speedscope file.
From this: https://github.com/dotnet/diagnostics/blob/master/documentation/dotnet-trace-instructions.md

If you would rather view the trace on a Linux machine, you can do this by changing the output format of dotnet-trace to speedscope. You can change the output file format using the -f|--format option - -f speedscope will make dotnet-trace to produce a speedscope file. You can currently choose between nettrace (the default option) and speedscope. Speedscope files can be opened at https://www.speedscope.app.

But it sounds like you want to view events as they are coming in, which I think would require a new tool to be built.

@TIHan
Copy link
Member

TIHan commented Dec 3, 2019

As another FYI, I think this is how dotnet trace can connect to the EventPipe: https://github.com/dotnet/diagnostics/blob/master/src/Microsoft.Diagnostics.Tools.RuntimeClient/DiagnosticsIpc/IpcClient.cs - at least it should help if you want to have your own console app for getting trace events.

If we were to have a tool that will show live events, I think it should be an option on dotnet trace, something like: dotnet trace --live or equivalent.

@TIHan
Copy link
Member

TIHan commented Dec 4, 2019

https://github.com/dotnet/diagnostics/blob/master/documentation/design-docs/diagnostics-client-library.md
There is an example that shows how to get GC events in real-time, which could extend to any kind of events depending on what provider you choose. If it's that easy, it would trivial to build a tool that you are talking about. However, this API is not built yet.

@adamsitnik
Copy link
Member Author

If you are on linux, there is an alternative to opening a nettrace file, and that would be using a speedscope file.

Thanks! I am actually the person who proposed and implemented the SpeedScope exporter microsoft/perfview#842 ;)

SpeedScope gives no possibility to display information about events, it only visualizes CPU samples.

There is an example that shows how to get GC events in real-time, which could extend to any kind of events depending on what provider you choose.

I am aware of diagnostics client lib, I would just prefer not to implement it on my own.

If we were to have a tool that will show live events, I think it should be an option on dotnet trace, something like: dotnet trace --live or equivalent.

I agree. IMHO extending dotnet trace would be the best.

@TIHan
Copy link
Member

TIHan commented Dec 4, 2019

I am actually the person who proposed and implemented the SpeedScope exporter

Very cool! Then you will definitely know more about it than me. :) Been looking at it to understand how it works.

SpeedScope gives no possibility to display information about events, it only visualizes CPU samples.

Didn't know about that; it does limit its uses then.

I would just prefer not to implement it on my own.

I agree that would be nice to already have.

I did some experimenting and managed to add a --live option on the subcommand collect. It would then consume the EventPipe stream, pretty much the same way that GC live event sample does, and print out some event data in real-time. I think it should be straightforward to implement, and it doesn't have to be --live. At this point, I guess it's not really a matter of implementation, but what the design will actually be; and if the team wants it :) .

@sywhang
Copy link
Contributor

sywhang commented Dec 4, 2019

@adamsitnik Noah is OOF until January so I'll answer some of the questions here on his behalf :)

do we have any plans for a tool like this?

Yes, we have #564 filed tracking this work item. The interop team has asked for this, specifically for binder tracing. It seems like many people are interested in seeing this happen, so I am hoping that either John or I would be able to work on this.

I can't view the events without copying the nettrace file to Windows and opening it with PerfView.

This is another work item that's being tracked by #489 - it seems like you just want to view the events in live, but this particular work item tracks implementing/extending a new/existing tool to be able to read a trace file without having to copy it onto a Windows box. Again, it seems like this is a popular request so it is on our radar of things to do.

Hope that helps!

@sywhang sywhang added the duplicate This issue or pull request already exists label Dec 4, 2019
@TIHan
Copy link
Member

TIHan commented Dec 4, 2019

Thanks for the info @sywhang .

TryDotNet/DotNetInterative is interested in this as well and we do want live events for the Jupyter notebooks.

@adamsitnik
Copy link
Member Author

@sywhang @TIHan thanks for all the information and great discussion!

I am closing the issue since it's a duplicate of #564 and #489

@dotnet dotnet locked as resolved and limited conversation to collaborators Jun 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants