Meter.CreateObservableCounter Method

Definition

Overloads

CreateObservableCounter<T>(String, Func<IEnumerable<Measurement<T>>>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

CreateObservableCounter<T>(String, Func<Measurement<T>>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

CreateObservableCounter<T>(String, Func<T>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

CreateObservableCounter<T>(String, Func<IEnumerable<Measurement<T>>>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T> (string name, Func<System.Collections.Generic.IEnumerable<System.Diagnostics.Metrics.Measurement<T>>> observeValues, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableCounter : string * Func<seq<System.Diagnostics.Metrics.Measurement<'T>>> * string * string -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValues As Func(Of IEnumerable(Of Measurement(Of T))), Optional unit As String = Nothing, Optional description As String = Nothing) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. Cannot be null.

observeValues
Func<IEnumerable<Measurement<T>>>

The callback to call to get the measurements when ObservableCounter{T}.Observe() is called by RecordObservableInstruments().

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

ObservableCounter<T>

A new observable counter.

Remarks

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<Measurement<T>>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T> (string name, Func<System.Diagnostics.Metrics.Measurement<T>> observeValue, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableCounter : string * Func<System.Diagnostics.Metrics.Measurement<'T>> * string * string -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValue As Func(Of Measurement(Of T)), Optional unit As String = Nothing, Optional description As String = Nothing) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement.

Parameters

name
String

The instrument name. Cannot be null.

observeValue
Func<Measurement<T>>

The callback to call to get the measurements when ObservableCounter{T}.Observe() is called by RecordObservableInstruments()

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

ObservableCounter<T>

A new observable counter.

Remarks

Example uses for ObservableCounter: The number of page faults for each process.

Applies to

CreateObservableCounter<T>(String, Func<T>, String, String)

Creates an ObservableCounter, which is an instrument that reports monotonically increasing values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableCounter<T> CreateObservableCounter<T> (string name, Func<T> observeValue, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableCounter : string * Func<'T (requires 'T : struct)> * string * string -> System.Diagnostics.Metrics.ObservableCounter<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableCounter(Of T As Structure) (name As String, observeValue As Func(Of T), Optional unit As String = Nothing, Optional description As String = Nothing) As ObservableCounter(Of T)

Type Parameters

T

The numerical type of the measurement..

Parameters

name
String

The instrument name. Cannot be null.

observeValue
Func<T>

The callback to call to get the measurements when ObservableCounter{T}.Observe() is called by RecordObservableInstruments().

unit
String

Optional instrument unit of measurements.

description
String

Optional instrument description.

Returns

ObservableCounter<T>

A new observable counter.

Remarks

Example uses for ObservableCounter: The number of page faults for each process.

Applies to