IncrementingEventCounter 类

定义

为不断增大的变量提供 EventCounter 的变体,例如运行时中的异常数。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

注解

IncrementingEventCounter 用于跟踪始终递增的值,例如请求总数、引发的异常的总数,等等。对于这类指标,只需报告总值并不一定用于监视其运行状况。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 可用于跟踪和报告由指标使用者指定的时间间隔内的增量。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 不会计算平均和标准偏差等统计信息,因为它只跟踪一段时间内的增量。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)

初始化 IncrementingEventCounter 类的新实例。Initializes a new instance of the IncrementingEventCounter class.

属性

DisplayName

获取或设置计数器的显示名称。Gets or sets the display name of the counter.

(继承自 DiagnosticCounter)
DisplayRateTimeScale

获取或设置此指标应显示为的速率。Gets or sets the rate at which this metric should be displayed as.

DisplayUnits

获取或设置计数器的显示单位。Gets or sets the display units of the counter.

(继承自 DiagnosticCounter)
EventSource

获取此计数器附加到的 EventSource。Gets the EventSource that this counter is attached to.

(继承自 DiagnosticCounter)
Name

获取此计数器的名称。Gets the name of this counter.

(继承自 DiagnosticCounter)

方法

AddMetadata(String, String)

将键值元数据添加到包含在有效负载中的计数器。Adds key-value metadata to the counter that will be included as a part of the payload.

(继承自 DiagnosticCounter)
Dispose()

EventSource 将报告的集合中删除计数器。Removes the counter from the set that the EventSource will report on.

(继承自 DiagnosticCounter)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
Increment(Double)

将值添加到将在下一个计时器间隔由计数器发布的汇总。Adds a value to a running total that will be published by the counter at the next timer interval.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回当前递增事件计数器实例的字符串表示形式。Returns a string representation of the current incrementing event counter instance.

适用于