IncrementingEventCounter Class


Provides a variant of EventCounter for variables that are ever-increasing, such as the number of exceptions in the runtime.

public ref class IncrementingEventCounter : System::Diagnostics::Tracing::DiagnosticCounter
public class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter
type IncrementingEventCounter = class
    inherit DiagnosticCounter
Public Class IncrementingEventCounter
Inherits DiagnosticCounter


IncrementingEventCounter is used for keeping track of values that are always increasing, such as the total number of requests, the total number of exceptions thrown, etc. For such metrics, simply reporting the total value is not necessarily useful for monitoring its health. For example, keeping track of how many bytes have been allocated in total for the entire duration of the process is not useful for diagnosing any potential issues from allocating too much memory. A metric that would help us is how many bytes were allocated in the past minute, hour, or some arbitrary time interval, and not the entire duration of the process. IncrementingEventCounter can be used to keep track of and report just the increments over a time interval that was specified by the consumer of the metric.

IncrementingEventCounter does not calculate statistics like mean or standard deviation because it only keeps track of the increments over a period of time.


IncrementingEventCounter(String, EventSource)

Initializes a new instance of the IncrementingEventCounter class.



Gets or sets the display name of the counter.

(Inherited from DiagnosticCounter)

Gets or sets the rate at which this metric should be displayed as.


Gets or sets the display units of the counter.

(Inherited from DiagnosticCounter)

Gets the EventSource that this counter is attached to.

(Inherited from DiagnosticCounter)

Gets the name of this counter.

(Inherited from DiagnosticCounter)


AddMetadata(String, String)

Adds key-value metadata to the counter that will be included as a part of the payload.

(Inherited from DiagnosticCounter)

Removes the counter from the set that the EventSource will report on.

(Inherited from DiagnosticCounter)

Determines whether the specified object is equal to the current object.

(Inherited from Object)

Serves as the default hash function.

(Inherited from Object)

Gets the Type of the current instance.

(Inherited from Object)

Adds a value to a running total that will be published by the counter at the next timer interval.


Creates a shallow copy of the current Object.

(Inherited from Object)

Returns a string representation of the current incrementing event counter instance.

Applies to