Meter.CreateObservableGauge Method

Definition

Overloads

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

Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.

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

Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.

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

Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.

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

Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.

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

ObservableGauge<T>

A new observable gauge.

Remarks

An example of a non-additive value is the room temperature; that is, it doesn't make sense to report the temperature value from multiple rooms and sum them up.

Applies to

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

Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableGauge<T> CreateObservableGauge<T> (string name, Func<System.Diagnostics.Metrics.Measurement<T>> observeValue, string? unit = default, string? description = default) where T : struct;
member this.CreateObservableGauge : string * Func<System.Diagnostics.Metrics.Measurement<'T>> * string * string -> System.Diagnostics.Metrics.ObservableGauge<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableGauge(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 ObservableGauge(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

ObservableGauge<T>

A new observable gauge.

Remarks

An example of a non-additive value is the room temperature; that is, it doesn't make sense to report the temperature value from multiple rooms and sum them up.

Applies to

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

Creates an ObservableGauge, which is an asynchronous instrument that reports non-additive values when the instrument is being observed.

public System.Diagnostics.Metrics.ObservableGauge<T> CreateObservableGauge<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.CreateObservableGauge : string * Func<seq<System.Diagnostics.Metrics.Measurement<'T>>> * string * string -> System.Diagnostics.Metrics.ObservableGauge<'T (requires 'T : struct)> (requires 'T : struct)
Public Function CreateObservableGauge(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 ObservableGauge(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

ObservableGauge<T>

A new observable gauge.

Remarks

An example of a non-additive value is the room temperature; that is, it doesn't make sense to report the temperature value from multiple rooms and sum them up.

Applies to