4

Microsoft documentation lists some well known event counters. How do I expose those to an Open Telemetry collector? (using the Prometheus exporter, ideally)

Moose Morals
  • 1,628
  • 25
  • 32
  • 1
    You could read them manually and write logic to export them to Prometheus, see [this example](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/event-counters#sample-code) – Peter Bons Jul 14 '22 at 07:26
  • yup, that's the fallback position, but I'm still holding out for another option – Moose Morals Jul 14 '22 at 19:36
  • The dotnet-monitor app does this with its /metrics endpoint and might be a useful starting point. Currently it can only monitor a single process at a time. https://github.com/dotnet/dotnet-monitor/blob/main/documentation/api/metrics.md – Nathan Smith Sep 14 '22 at 19:19

1 Answers1

2

According to the OpenTelemetry GitHub ticket Export .net event counters through OpenTelemetry, these counters aren't directly supported yet. They say:

Once EventCounter -> Metric API instrumentation lands, this would be easier. For now, you'll have to write own event counter listener, and in turn, convert them to the new Metrics API.

As of Jan. 11, 2022, this work is slated to be part of "the -contrib repo." Unfortunately, as of Sep. 2022, they're still working on it -- though it does appear to be getting close.

ladenedge
  • 13,197
  • 11
  • 60
  • 117