Skip to content

Add remarks for EventCounter APIs #3278

Open
@mairaw

Description

@mairaw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri2Indicates issues/PRs that are medium priorityPri3Indicates issues/PRs that are low priorityarea-System.Diagnostics.Tracingdoc-enhancementImprove the current content

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions