I have a stateless service that listens to an EventHub in Service Fabric, and I want to collect performance metrics like the receive latency, and the cpu and memory usage in the nodes in the cluster. What is the easiest way of doing that? I read a lot about that but most examples I saw were showing how to do it with Cloud services which I found quite different from Service Fabric. I also read that Azure Diagnostics could be used to collect performance counters, but I didn't find a clear way of doing it programmatically from Visual Studio.
You can use Application Insighs. It is announced at Build 2017 (See the last few minutes) and still in beta but it gives you a very good overview of how the services are doing.
I did make a repo myself that integrates Application Insights with Service Fabric. With some coding you can wire it up using my code as a guideline/example. Just for performance counters per node it is relatively easy.
Another option would be using EventFlow to collect the performance counter data and send it to wherever you want (there are limited build-in options but it is easy to write a sink yourself)
I am sure there are more but I think Application Insights is your best bet as it supports everything from performance counters (per node) to request telemetry and it is extensible as well.