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

Definition

Create a metrics Counter object.

public System.Diagnostics.Metrics.Counter<T> CreateCounter<T> (string name, string? unit = default, string? description = default) where T : struct;
member this.CreateCounter : string * string * string -> System.Diagnostics.Metrics.Counter<'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 Counter(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

Counter<T>

A new counter.

Remarks

Counter is an Instrument which supports non-negative increments. Example uses for Counter: count the number of bytes received, count the number of requests completed, count the number of accounts created, count the number of checkpoints run, and count the number of HTTP 5xx errors.

Applies to