Dela via


IMeter.CreateCounter<T>(String, String, String) Method

Definition

Create a Counter, which is an instrument that can be used to track counts/sums in monotonic scenarios (always increase/decrease).

public Microsoft.VisualStudio.Telemetry.Metrics.ICounter<T> CreateCounter<T> (string name, string unit = default, string description = default) where T : struct;
abstract member CreateCounter : string * string * string -> Microsoft.VisualStudio.Telemetry.Metrics.ICounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateCounter(Of T As Structure) (name As String, Optional unit As String = Nothing, Optional description As String = Nothing) As ICounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. Cannot be null.

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

A new counter.

Exceptions

Throws if T is not a valid numeric type. For supported types, check documentation: Microsoft.VisualStudio.Telemetry.Metrics.Counter`1.

Applies to