Add remarks for EventCounter APIs #3278
Labels
area-System.Diagnostics.Tracing
doc-enhancement
Improve the current content
Pri2
Indicates issues/PRs that are medium priority
Pri3
Indicates issues/PRs that are low priority
Milestone
Vance's comment for the F-level API docs:
dotnet/docs#3262 (comment)
There is a tutorial here
https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md
Which gives a quick example. (There are only two APIs the constructor and WriteMetric API). The EventCounter functionality is meant to be an extension of EventSource logging.
The goal of EventSource is logging. The idea is that to create new logging messages, you create a subclass System.Diagnostics.Tracing.EventSource, and you define methods for each distinct kind of message that you wish to log. . You declare arguments to this method to allow the instrumentation point to pass any information you wish to log
The bodies of these subclass methods then call 'WriteEvent' which pass the information long to whoever subscribes to your EventSource.
EventCounters allow you to instead of logging on every event, you simply gather aggregations on every event (computing just the count, sum, min, max and variance). It is these AGREGATES that then get logged (and the subscriber has control over how often the aggregates get sent). This allows even very high frequency events to be monitored cheaply.
The recommendation (which the tutorial illustrates), is to have the EventSource method call both the WriteEvent and WriteMetric API. The subscriber can then decide which of them (or both) to turn on at runtime, allowing the subscriber to have either low overhead or high detail logging.
In the short term, you can simply point at the tutorial in the remarks, but it would not hurt to have a short summary along the lines of the above for the class that you can refer to in both the constructor and WriteMetric methods.
The text was updated successfully, but these errors were encountered: