Here is another part of the problem with code sample:
.Net - how to parse histogram metrics using TraceEvent?
I have observable metrics (gauges) to read. if i run dotnet-counters i get values from these metrics once a sec.
The dotnet-counters is built upon DiagnosticsClient
- same as what I use.
How can I "observe" an observable instrument via DiagnosticsClient
?
Thanks to the Microsoft Diagnostics project contributors the answer is here (need to set refresh interval): https://github.com/dotnet/diagnostics/issues/4727#issuecomment-2184907527
List<EventPipeProvider> providers = new()
{
new EventPipeProvider("System.Diagnostics.Metrics", EventLevel.Verbose, keywords: -1, arguments: new Dictionary<string, string>
{
["Metrics"] = "MyApp",
["RefreshInterval"] = "1",
["MaxTimeSeries"] = "1000",
["MaxHistograms"] = "10",
}),
};