DEV Community

loading...

Discussion on: Reporting Metrics Using .Net (Core) EventSource and EventCounter

steveharveyuk profile image
SteveHarveyUK

I want to be able to have a number of independent EventSources with EventCounters collecting different metrics with each having its own EventListener that only receives the events from the EventSource and EventCounter that was enabled against it at potentially different frequencies.

So for instance I can have one instance monitoring cache table usage and delivering me the update rate per second and perhaps another giving me the stats against all queues in an application every five seconds.

I believe that I've achieved that with my example code, BUT I've had to manually filter the EventCounter events as they don't seem to be filtered by the framework based on the EventSource passed into EventListener.EnableEvents() method.

I'm just trying to check that I've not missed something as I'd have expected the built in filtering that appears to work on EventSource.WriteEvent() to work for the EventCounter events too.

Thread Thread
expecho profile image
Peter Bons Author

If you do not want to collect metrics just don't pass the EventCounterIntervalSec argument in the dictionary. Otherwise just use another interval. I made some changes to your repo but can't push them to your repo. Can you add me as a contributer? (I can't fork your repo since it is a fork of mine)

Thread Thread
steveharveyuk profile image
SteveHarveyUK

Added as collaborator. Thanks for your help!!

Thread Thread
expecho profile image
Peter Bons Author

I've created a pull request in which I demonstrate how I would do it. Probably better to communicate using the PR from now on.