Share via


ICounter<T> Interface

Definition

A Counter, as defined by the OpenTelemetry standard. OpenTelemetry Spec: https://opentelemetry.io/docs/reference/specification/metrics/api/ .NET API spec: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics.counter-1?view=net-6.0

This interface permits coding to the OpenTelemetry standard without upgrading our .NET Framework. Since it's the same standard, we can update implementations to a thin wrapper around OTel when ready. This also permits us to avoid re-instrumentation for developers.

public interface ICounter<T> : Microsoft.VisualStudio.Telemetry.Metrics.IInstrument where T : struct
type ICounter<'T (requires 'T : struct)> = interface
    interface IInstrument
Public Interface ICounter(Of T)
Implements IInstrument

Type Parameters

T

The counter type. Supported types: Byte, Int16, Int32, Int64, Double, Single, and Decimal.

Derived
Implements

Properties

Description

Gets the instrument description.

(Inherited from IInstrument)
Enabled

Gets a value indicating whether there are any listeners for this instrument.

(Inherited from IInstrument)
IsObservable

Gets a value indicating whether the instrument is an observable instrument.

(Inherited from IInstrument)
Meter

Gets the Meter that created the instrument.

(Inherited from IInstrument)
Name

Gets the instrument name.

(Inherited from IInstrument)
Unit

Gets the instrument unit of measurements.

(Inherited from IInstrument)

Methods

Add(T, KeyValuePair<String,Object>, KeyValuePair<String,Object>, KeyValuePair<String,Object>)

Records the increment value of the measurement.

Add(T, KeyValuePair<String,Object>, KeyValuePair<String,Object>)

Records the increment value of the measurement.

Add(T, KeyValuePair<String,Object>)

Records the increment value of the measurement.

Add(T, KeyValuePair<String,Object>[])

Records the increment value of the measurement.

Add(T, ReadOnlySpan<KeyValuePair<String,Object>>)

Records the increment value of the measurement.

Add(T)

Records the increment value of the measurement.

Applies to