4

I've got a .NET Core application that I would like to set up to listen to LTTng events, but I've found little to no documentation anywhere on how to actually do this in code, in C# / .NET Core. I've read a good deal about how even the CoreCLR team has taken a bet on LTTng being their primary tracing solution on Linux (while ETW is the natural extant solution on Windows), but nothing yet on any direction this could take in code. On the other hand, it is pretty easy (and well-documented) to set up an application to be an ETW listener in code (e.g. this is just one of myriad examples).

Has anyone had experience doing this, or seen any good documentation on this? Do the same libraries/packages/nugets still apply in the Linux world on .NET Core too (i.e. would I need to set up a TraceEventSession with associated TraceEventParsers acting on TraceEvents just like in Windows, or is there a different direction/set of packages needed in Linux)?

Any help would be greatly appreciated!

Note: I don't want to use the lttng tool itself for traces, but want to build the listening into the .NET Core application itself.

teeth
  • 73
  • 2
  • 6

1 Answers1

0

As far as I know, there is no API for receiving LTTng events in .NET Core. But since .NET Core 2.2 you can use EventListener to listen to the events generated by CLR in the same process. You can find instructions here.

If you need not only in-process events, then you should write some native code in C/C++ using liblttng-ctl (see https://github.com/lttng/lttng-tools for details) and Babeltrace 2 C API.