async methods in nettrace

Hello.

I make a trace using dotnet-trace. Code contains asynchronous calls.

But in dotTrace I don’t see events with async prefix.

When I make a trace using dotTrace, calls with the async prefix are visible.

Why and how to fix it?

0
5 comments

Hello, Daniil!

The described situation is expected, we don't support proper asyncs handling in nettrace files now. It occurs because we need the following things to do it:

  • specially configured `System.Threading.Tasks.TplEventSource` provider
  • a state machine for async calls that we build during Timeline profiling by parsing loaded assemblies and extracting the necessary information from them

Unfortunately, the second point is hardly possible in the case of nettrace. We assume that the modules whose information is recorded in the nettrace file may change between the time the nettrace file was collected and the time it was opened in dotTrace. If the profiling took place on a different machine, the modules will not be available at all. 

It could be possible to resolve the situation when profiling and opening the nettrace file occurs on the same machine and the application is left unchanged during this time. However, it is necessary to check somehow that conditions are really satisfied. I don't know if it's possible, this question should be investigated. But actually, in this case, it is much simpler to just collect a Timeline snapshot in dotTrace.

1

I understand.

We have such a case that we want to collect traces in kubernetes, from pods (containers). We do this using a dotnet monitor (sidecar). And we want to improve the readability of the collected traces. Is it possible to use dotTrace in this case?

Are there any plans to improve nettrace and dottrace compatibility?
Perhaps some known improvement needs to be made on the dotnet side?

0

You can use dotTrace command-line tool to profile your code inside containers. This article can be useful for you to avoid some known issues with profiling in Kubernetes.

I have never used dotnet-monitor, so I don't know its details. But as far as I see in the documentation, it's possible to configure dotnet-monitor to run an external executable by using the Execute action. So, it should be possible to run dotTrace CLT from dotnet-monitor action.

Also, an alternative approach exists that may be interesting to you. It's possible to run and control profiling with dotTrace from your code using a Profiling API or SelfApi. You can read about them in this article. Unfortunately, Timeline profiling mode with Profiling API or SelfApi is only available on Windows for now.

Considering nettrace support in dotTrace, we have no plans to develop this direction in the foreseeable future.

1

We have discussed your question about nettrace support in dotTrace with the team and figured out how we can and want to develop it. 

I created a meta-issue DTRC-30219 and linked several related issues to it. If you want to track the progress, you can vote for the task.

1

Please sign in to leave a comment.