Share via


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

Definition

Create a VS Counter, which is an instrument that can be used to track counts/sums in monotonic scenarios (always increase/decrease). The VS version of a counter enables additional properties but requires additional work to migrate to OpenTelemetry when available.

public Microsoft.VisualStudio.Telemetry.Metrics.IVSCounter<T> CreateVSCounter<T>(string name, string unit = default, string description = default) where T : struct;
abstract member CreateVSCounter : string * string * string -> Microsoft.VisualStudio.Telemetry.Metrics.IVSCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateVSCounter(Of T As Structure) (name As String, Optional unit As String = Nothing, Optional description As String = Nothing) As IVSCounter(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 VS counter.

Exceptions

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

Applies to